Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I'm trying to make Total cumulative sales compared to the previous year's chart and I'm struggling to stop the chart:
My measure is as follows:
Cumulative sales =
--current day of year:
var _max = datediff(date(year(maxX(allselected(SalesDB), SalesDB[Date])),1,1),maxX(allselected(SalesDB), SalesDB[Date]),DAY)+1
return
CALCULATE (
sum(SalesDB[SalesAmount]),
FILTER (
ALL ( SalesDB ),
SalesDB[Date] <= MAX (SalesDB[Date])
&& SalesDB[Day_of_year] <= _max --add only this day of year
&& SalesDB[Year]=year(max(SalesDB[Date])) --resets yeach year
)
)
Any idea - how to stop this chart at today's Day_of_year?
I do have a more simple measure which stops just fine, but it is not cumulative:
Sales till today =
--current day of year
var _max = datediff(date(year(maxX(allselected(SalesDB), SalesDB[Date])),1,1),maxX(allselected(SalesDB), SalesDB[Date]),DAY)+1
return
calculate(sum(SalesDB[SalesAmount]), filter(SalesDB, SalesDB[Day_of_year]<=_max))
Thanks!
Solved! Go to Solution.
OK, here's my version of what you have...
... and here's my IF Statement that DOES NOT do the Calcuatle math if Day_Of_Year in the talbe is Greater than Today's Day of Yyear....
Proud to give back to the community!
Thank You!
I'll start playing with the DAX code, but I'm thinking we'll have to add an IF statement, so that if the Day of Year is > Current Year, Day of Year, then BLANK(), else do you Culmative calculation?
Forrest
Cumulative sales =
--current day of year:
var _max = datediff(date(year(maxX(allselected(SalesDB), SalesDB[Date])),1,1),maxX(allselected(SalesDB), SalesDB[Date]),DAY)+1
return
CALCULATE (
sum(SalesDB[SalesAmount]),
FILTER (
ALL ( SalesDB ),
SalesDB[Date] <= MAX (SalesDB[Date])
&& SalesDB[Day_of_year] <= _max --add only this day of year
&& SalesDB[Year]=year(max(SalesDB[Date])) --resets yeach year
)
)
Proud to give back to the community!
Thank You!
OK, here's my version of what you have...
... and here's my IF Statement that DOES NOT do the Calcuatle math if Day_Of_Year in the talbe is Greater than Today's Day of Yyear....
Proud to give back to the community!
Thank You!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
110 | |
91 | |
84 | |
66 |