Forum Discussion
TheHans
5 years agoHelper I
Get previous date values
Hi Guys, I have a table that contains a report date and values for that date. The dates are unique in the table. In the visual I would like to highlight the differences of Amount 1 (Report date-Pr...
- 5 years ago
Hi,
pls see below:
PrevAmount = VAR _selDate = SELECTEDVALUE(DimDate[Date]) VAR _maxDate = CALCULATE(LASTNONBLANK(DimDate[Date], CALCULATE(SUM('Table'[Amount1]))), FILTER(ALLSELECTED(DimDate), [Date] < _selDate)) RETURN IF(NOT(ISBLANK(SUM('Table'[Amount1]))), CALCULATE(SUM('Table'[Amount1]), FILTER(ALLSELECTED(DimDate),DimDate[Date] = _maxDate)), BLANK())Kind regards, Steve.
amitchandak
5 years agoSuper User
TheHans , Try a measure like
calculate(sum(Table[Amount1]), filter(allselected(Table), Table[Date] =calculate(max(Table[Date]),filter(allselected(table), [Date] <max([Date])))))
TheHans
5 years agoHelper I
Hi Amit,
thanks for the quick reply. I get as a result 24 for every row.
Is there a way to add new columns as in my example "Prev. Amount1" and "Prev. Amount1" which is calculated out of the existing data in the table?
Basically the result of this should look like in the sample table above.
Hans