Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello,
I am a pretty new user to PowerBI. I would like to set up a comined graph. Sales per week comparing current with previous year by week. This is no problem. But I would like to add to lines with the cumulated sales per week for the current and the previous year.
I have tried setting up a new measure using a DAX expression I found in another post:
Measure =
CALCULATE( SUM(Sales[SalesValue), FILTER(ALL(Calendar), Calendar[WeekNumber] <= SELECTEDVALUE(Calendar[WeekNumber]) ) )
I guess I have to set up one measure per year and add to the formula a filter for the year? Am I on the right track and how would I modify the formula to get the desired result?
Thanks,
Bastian
Solved! Go to Solution.
@Basti76 , Try like with date table or an independent Year/week table joined to your table
YTD= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) && 'Date'[Week] <= Max('Date'[Week]) ))
LYTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[Week] <= Max('Date'[Week])))
@Basti76 , Try like with date table or an independent Year/week table joined to your table
YTD= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) && 'Date'[Week] <= Max('Date'[Week]) ))
LYTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[Week] <= Max('Date'[Week])))
User | Count |
---|---|
84 | |
75 | |
73 | |
42 | |
36 |
User | Count |
---|---|
114 | |
56 | |
52 | |
43 | |
42 |