Forum Discussion
campelliann
Post Patron
4 years agoLastDate vs MAX (date)
Hi, So I was using Max (date) successfully to get the cummulative revenue in 2021 with a filter like date< max(date) on a measure. The max(date) with the filter context returns the correspondent m...
- 4 years ago
campelliann If you have it working, I'd walk away and declare victory. What does the LASTDATE version of that look like? This?
calculate(sum(Valores_Finais[Total]),filter(all('Z_Calendário Slicer'),'Z_Calendar Slicer'[YearMonth]<=LASTDATE('Z_Calendar Slicer'[YearMonth])),filter(all(Valores_Finais),Valores_Finais[Type]="Baseline"))I don't see how that would work since you would be trying to compare a scalar to a table. And if it is this:
calculate(sum(Valores_Finais[Total]),filter(all('Z_Calendário Slicer'),LASTDATE('Z_Calendar Slicer'[YearMonth])),filter(all(Valores_Finais),Valores_Finais[Type]="Baseline"))Then you would only get the last (biggest) [YearMonth] and would lose the < part.
campelliann
Post Patron
4 years agoFirst and foremost thank you for your help.
Greg_Deckler Anonymous the measure I am using is this:
Consumo Baseline YTD =
calculate(sum(Valores_Finais[Total]),filter(all('Z_Calendário Slicer'),'Z_Calendar Slicer'[YearMonth]<=MAX('Z_Calendar Slicer'[YearMonth])),filter(all(Valores_Finais),Valores_Finais[Type]="Baseline"))
I am using this on a chart, where the months are in x axis (january-september) with Z_calendar slicer [YearMonth] field. What I do not get is why the Lastdate does not work in this case to have an cumulative YTD revenue and MAX does- I read that its a table (not a scalar), but LASTDATE is supposed to consider the filter context, so I do not get why I always get the revenue of September with the LASTDATE.
I am using this on a chart, where the months are in x axis (january-september) with Z_calendar slicer [YearMonth] field. What I do not get is why the Lastdate does not work in this case to have an cumulative YTD revenue and MAX does- I read that its a table (not a scalar), but LASTDATE is supposed to consider the filter context, so I do not get why I always get the revenue of September with the LASTDATE.
- Greg_Deckler4 years ago
Community Champion
campelliann If you have it working, I'd walk away and declare victory. What does the LASTDATE version of that look like? This?
calculate(sum(Valores_Finais[Total]),filter(all('Z_Calendário Slicer'),'Z_Calendar Slicer'[YearMonth]<=LASTDATE('Z_Calendar Slicer'[YearMonth])),filter(all(Valores_Finais),Valores_Finais[Type]="Baseline"))I don't see how that would work since you would be trying to compare a scalar to a table. And if it is this:
calculate(sum(Valores_Finais[Total]),filter(all('Z_Calendário Slicer'),LASTDATE('Z_Calendar Slicer'[YearMonth])),filter(all(Valores_Finais),Valores_Finais[Type]="Baseline"))Then you would only get the last (biggest) [YearMonth] and would lose the < part.