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)
Greg_Deckler
Community Champion
4 years agoAnonymous Maybe something like:
Measure =
VAR __Date = SELECTEDVALUE('Calendar'[Date])
VAR __Value = CALCULATE(SUM('Table'[Values]),[Date]=__Date)
VAR __NewDate = IF(ISBLANK(__Value),MAX('Table'[Date]),__Date)
RETURN
CALCULATE(SUM('Table'[Values]),[Date]=__NewDate)