Forum Discussion
Anonymous
4 years agoNot applicable
CONDITIONAL DATES
Hi, I'm developing a daily report in Power BI, but if the user select a date where there´s no data, Power BI should select data from the last date with information: CASE 1 - The user selected...
- 4 years ago
Try:
Sum Values = VAR MaxDate = MAXX(FILTER(ALL(Table[Date), Table[Date] <= SELECTEDVALUE(IndDate[Date]) && NOT(ISBLANK(SUM(Table[Values])))), Table[Date]) RETURN CALCULATE(SUM(Table[Values]), FILTER(ALL(Table[Date]), Table[Date] = MaxDate)
Anonymous
4 years agoNot applicable
Good morning, Paul
Thank you very much for your input.
I tried to use your sugestion, but the report now returns the same value for all FACILITIES, like this:
Facilities Date Values
---------------------------------
FAC001 2021-08-16 90.24
FAC002 2021-08-16 90.24
FAC003 2021-08-16 90.24
What I really need is that for each FACILITY the report returns its last date and value.
Benedito Almeida.
PaulDBrown
4 years agoCommunity Champion
Try:
Sum Values =
VAR MaxDate = MAXX(FILTER(ALL(Table[Date), Table[Date] <= SELECTEDVALUE(IndDate[Date]) && NOT(ISBLANK(SUM(Table[Values])))), Table[Date])
RETURN
CALCULATE(SUM(Table[Values]), FILTER(ALL(Table[Date]), Table[Date] = MaxDate)