*SOLVED* Power Bi Custom Gantt Chart using Matrix [closed] - matrix

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 days ago.
Improve this question
I am building a custom gantt chart in Power Bi using the matrix view. The information is displayed using a measure to assign conditional formatting. In the measure, I have assigned the value of 1 to completed projects, and the value of 2 to in progress projects, the issue I am having however is that the in progress periodically shows up after the project is completed, so I need to tell the formulas to not display the value of 2 if there is a completed date.
Here is my current dax code:
`'Conditional Formatting Actual =
VAR StartDateProject =
CALCULATE(
MIN('Research Requests'[StartDate]),
REMOVEFILTERS('Calendar'[Date])
)
VAR EndDateProject =
CALCULATE(
MIN('Research Requests'[CompletedDate]),
REMOVEFILTERS('Calendar'[Date])
)
VAR ProjectPeriod =
MIN('Calendar'[Date])>=StartDateProject
&& MIN('Calendar'[Date])<=EndDateProject
VAR CurrentProject =
MAX('Calendar'[Date])>=StartDateProject
&& StartDateProject <> 0
&& MAX('Research Requests'[CompletedDate]) = 0
VAR Result =
SWITCH(
TRUE(),
ProjectPeriod,
1,
CurrentProject,
2
)
RETURN Result'`
I have messed with using MIN and MAX and changing up the switch statement to an if statement, but none of these worked as expected and most of my attempts have resulted in 2 being in every column and row instead of just the expected, and periodically overwriting my 1s.

Related

Calculate Total Amount for a specific period

I want to calculate total value between two dates in DAX. I have a formula SUM(C5:C16) in excel sheet, which C5 is the sales amount for a specific date (last year + 1month), and C16 is the sales amount for current row date.
I tried this formula in DAX, but it did not return sum value:
var Rolling = CALCULATE(sum('proces'[HOURS]),DATESINPERIOD('Date'[DateField],ENDOFMONTH('proces'[date_start]),-12,MONTH))
Also, I tried this one, but it is not working:
=SumX (
var prev=DATEADD(DATEADD('proces'[date_start] ,-1,YEAR),+1,MONTH)
return
Filter ( 'proces',
'proces'[date_end] <= Earlier ( 'proces'[date_end] ) &&
'proces'[date_start]>=prev,
'proces'[HOURS])
Also, I tried this one but it returns nothing
=CALCULATE(
SUMX('proces','proces'[HOURS]),
DATESBETWEEN(
'Date'[DateField],
STARTOFMONTH(DATEADD(LASTDATE('Date'[DateField]),-1,MONTH)),
ENDOFMONTH(DATEADD('Date'[DateField],-1,MONTH))
)
)
You seem to be confused about variables in DAX and your formulas are not even valid DAX expressions. Learn about variables in the official documentation:
Use variables to improve your DAX formulas
If you need further help with calculating the your total amount, add sample data to your question.

Google Sheets add a Permanent timestamp

I am setting up a sheet where a person will be able to check a checkbox, in different times, depending on the progress of a task. So, there are 5 checkboxes per row, for a number of different tasks.
Now, the idea is that, when you check one of those checkboxes, a message builds up in the few next cells coming after. So, the message is built in 3 cells. The first cell is just text, the second one is the date, and the third one is time. Also, those cells have 5 paragraphs each (one per checkbox).
The problem comes when I try to make that timestamp stay as it was when it was entered. As it is right now, the time changes every time I update any part of the Google Sheet.
I set u my formulas as follows:
For the text message:
=IF($C4=TRUE,"Insert text 1 here","")&CHAR(10)&IF($E4=TRUE, "Insert text here","")&CHAR(10)&IF($G4=TRUE, "Insert text 3 here","")&CHAR(10)&IF($I4=TRUE, "Insert text 4 here,"")&CHAR(10)&IF($K4=TRUE, "Insert text 5 here","")
For the date:
=IF($C4=TRUE,(TEXT(NOW(),"mmm dd yyyy")),"")&CHAR(10)&IF($E4=TRUE,(TEXT(NOW(),"mmm dd yyyy")),"")&CHAR(10)&IF($G4=TRUE,(TEXT(NOW(),"mmm dd yyyy")),"")&CHAR(10)&IF($I4=TRUE,(TEXT(NOW(),"mmm dd yyyy")),"")&CHAR(10)&IF($K4=TRUE,(TEXT(NOW(),"mmm dd yyyy")),"")
And for the time:
=IF($C4=TRUE,(TEXT(NOW(),"HH:mm")),"")&CHAR(10)&IF($E4=TRUE,(TEXT(NOW(),"HH:mm")),"")&CHAR(10)&IF($G4=TRUE,(TEXT(NOW(),"HH:mm")),"")&CHAR(10)&IF($I4=TRUE,(TEXT(NOW(),"HH:mm")),"")&CHAR(10)&IF($K4=TRUE,(TEXT(NOW(),"HH:mm")),"")
And it all looks like this:
I would appreciate it greatly if anyone could help me get this to work so that date and time are inserted after checking those boxes and they donĀ“t change again
Notice that your struggle with the continuous changing date time. I had the same struggle as yours over the year, and I found a solution that works for my case nicely. But it needs to be a little more "dirty work" with Apps Script
Some background for my case:
I have multiple sheets in the spreadsheet to run and generate the
timestamp
I want to skip my first sheet without running to generate timestamp
in it
I want every edit, even if each value that I paste from Excel to
generate timestamp
I want the timestamp to be individual, each row have their own
timestamp precise to every second
I don't want a total refresh of the entire sheet timestamp when I am
editing any other row
I have a column that is a MUST FILL value to justify whether the
timestamp needs to be generated for that particular row
I want to specify my timestamp on a dedicated column only
function timestamp() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const totalSheet = ss.getSheets();
for (let a=1; a<totalSheet.length; a++) {
let sheet = ss.getSheets()[a];
let range = sheet.getDataRange();
let values = range.getValues();
function autoCount() {
let rowCount;
for (let i = 0; i < values.length; i++) {
rowCount = i
if (values[i][0] === '') {
break;
}
}
return rowCount
}
rowNum = autoCount()
for(let j=1; j<rowNum+1; j++){
if (sheet.getRange(j+1,7).getValue() === '') {
sheet.getRange(j+1,7).setValue(new Date()).setNumberFormat("yyyy-MM-dd hh:mm:ss");
}
}
}
}
Explanation
First, I made a const totalSheet with getSheets() and run it
with a for loop. That is to identify the total number of sheets
inside that spreadsheet. Take note, in here, I made let a=1;
supposed all JavaScript the same, starts with 0, value 1 is to
skip the first sheet and run on the second sheet onwards
then, you will notice a function let sheet = ss.getSheets()[a]
inside the loop. Take note, it is not supposed to use const if
your value inside the variable is constantly changing, so use
let instead will work fine.
then, you will see a function autoCount(). That is to make a for
loop to count the number of rows that have values edited in it. The
if (values[i][0] === '') is to navigate the script to search
through the entire sheet that has value, looking at the row i and
the column 0. Here, the 0 is indicating the first column of the
sheet, and the i is the row of the sheet. Yes, it works like a
json object with panda feeling.
then, you found the number of rows that are edited by running the
autoCount(). Give it a rowNum variable to contain the result.
then, pass that rowNum into a new for loop, and use if (sheeet.getRange(j+1,7).getValue() === '') to determine which row
has not been edited with timestamp. Take note, where the 7 here
indicating the 7th column of the sheet is the place that I want a
timestamp.
inside the for loop, is to setValue with date in a specified
format of ("yyyy-MM-dd hh:mm:ss"). You are free to edit into any
style you like
ohya, do remember to deploy to activate the trigger with event type
as On Change. That is not limiting to edit, but for all kinds of
changes including paste.
Here's a screenshot on how it would look like:
Lastly, please take note on some of my backgrounds before deciding to or not to have the solution to work for your case. Cheers, and happy coding~!

How to convert a recursive excel formula to DAX

I am trying to transfer this excel operation to DAX in PowerBI. An illustration of the problem is shown in Excel screenshot. I am basically calculating the weighted average and placing it in the cell below. I know this same logic cannot be used in DAX. Is there a way to work around it? It is referencing the same column I am defining. I know this is possible in excel and was hoping there could be a workaround in Power BI. In my Power BI works, the columns being referenced are filtered from calculated measures. In the excel sheet, the columns A,B,C, and D are calculated. Here is a link to a .pbix file of this problem. Also included is an excel solution. The screenshot of the excel solution is shown below.
Cut the data table by the max date and add your calculatins. The maxDate-1 you will get from Matrix visual for each row in matrix. Then add caclulated values to each row. Then filnal culculation. The idea can loks like this (I did't check):
VAR Y36Value=
CALCULATE(
SELECTEDVALUE(table[Y])
,LASTDATE(table[DATE])
)
VAR filteredTable =
FILTER(
All(table)
, table[starting inv]<MAX(table[starting inv])-1 && Y36Value <> 0
)
VAR fltdTblWithValues =
ADDCLUMNS(
filteredTable
,"SumProductEF", [E]*[F]
,"SumProductYZ", [Y]*[Z]
)
VAR result =
DIVIDE(
SUMX(fltdTblWithValues,([SumProductEF]-[SumProductYZ])
,SUMX(fltdTblWithValues,E-Y)
)
If you add your values in a table format then I can check the measure.

Expressions and Filters SSRS

I have a few things I am struggling with so hopefully I can ask all at once ?
I am using VS 2010 and I think with Vb.net to build reports, I use databases from Sql - I am mainly using matrix tables
I have a report that is multiple tables in one but not sure how to set/define to still show the tables that has no data ? So currently if there is a blank one it messes up the full report look ?
In another scenario how can I use an expression/custom code to filter out items in one row - in a calculation for example if I only want to sum 3 items of 5 etc
How can I work out % of a row or coloumn based on criteria or filters so if total items is 30 and item 1 is 5 the % of will be 17% and all items will total to 100%
How can I work out growth of the row/column so if year 1 is 50 and year 2 is 60 the growth/variance will be 20%
There are some issues with the expressions:
=IIF(Fields!Total_Amount__Excl_VAT_.Value = 0
OR Fields!Total_Amount__Excl_VAT_.Value = "", 0, Sum(Fields!Total_Amount__Excl_VAT_.Value))
The SUM should be around the IIF:
=SUM(IIF(Fields!Total_Amount__Excl_VAT_.Value = 0
OR Fields!Total_Amount__Excl_VAT_.Value = "", 0, Fields!Total_Amount__Excl_VAT_.Value))
The same issue for
=IIF(Fields!Total_Amount__Excl_VAT_.Value = 0
OR Fields!Total_Amount__Excl_VAT_.Value = "",0,Sum(Fields!Total_Amount__Excl_VAT_.Value))
Should Be:
=SUM(IIF(Fields!Total_Amount__Excl_VAT_.Value = 0
OR Fields!Total_Amount__Excl_VAT_.Value = "", 0, Fields!Total_Amount__Excl_VAT_.Value))
The growth formula looks correct - are you getting a different result than expected?

Count amount separately depends on field value in Crystal Report VS2010

I am a beginner for Crystal report. I do not know how to work with formula editor.
My question is,
Table Name - Expenses
Field Name - Date, Purpose(Text), Less(Boolean), Amount(Double)
I want to count Less(Yes) Amount separately and Less(No) Amount separately. How to count this.
Please help me..
You will need two formulas:
Formula will show 1 for each record that has Less = True:
if less = True then 1
else 0
Formula 2 will show 1 for each record that has Less = False:
if less = False then 1
else 0
Now put those two formulas in your detail section and then do a sum on each one in your group footer. You can suppress the formulas in the detail section if you don't want to see them.
Hope that helps,
Chris

Resources