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.
Good Afternoon,
I am using a Clustered Column Chart to create a Week by Week comparison for 2020 vs 2019. Dataset starts at Jan 1, 2019
I have WeekNumber on the X-axis and Year in my Legend. I would only like to show a rolling 13 weeks time series.
So far I can show the last 13 weeks for 2020 by Filtering on Top 13 of Year-WeekNum.
I have also created a Week Rank and filtered on the Top 13 weeks (kudos to @amitchandak for the idea on Rank), thinking I can somehow work with this.
I am drawing blanks on how to grab the same 13 weeks for the Prior Year (2019) ???
Thoughts and suggestions are much appreciated.
Best Regards to All,
Solved! Go to Solution.
Assuming you have a Date table with a WeekNumber column, you should be able to use a measure like this that should give nonblank/shown values for the last 13 weeks.
NewMeasure =
VAR thisweek =
WEEKNUM ( TODAY () )
RETURN
CALCULATE (
[Your Measure],
KEEPFILTERS (
FILTER (
ALL ( 'Date'[WeekNumber] ),
'Date'[WeekNumber] <= thisweek
&& 'Date'[WeekNumber] >= thisweek - 12
)
)
)
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi @rsbin ,
You may create Week of Year column , and two rolling 13 week measures like DAX below.
Column:
Week of Year = WEEKNUM(Table1[Date])
Measure:
Rolling 13 Weeks Current Year =
VAR i= SELECTEDVALUE(Table1[Week])
RETURN
CALCULATE (SUM ( Table1[Sales] ),FILTER ( ALLSELECTED(Table1), YEAR(Table1[Date])= YEAR(MAX(Table1[Date]))&&Table1[Week] <= i + 12 && Table1[Week] >= i ) )
Rolling 13 Weeks Previous Year =
VAR i= SELECTEDVALUE(Table1[Week])
RETURN
CALCULATE (SUM ( Table1[Sales] ),FILTER ( ALLSELECTED(Table1), YEAR(Table1[Date])= YEAR(MAX(Table1[Date]))-1&&Table1[Week] <= i + 12 && Table1[Week] >= i ))
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @v-xicai
Thank you so much for sending an alternative solution. Although I think your Measures will work, I think @mahoneypat solution is slightly better suited for my clustered column chart.
Thanks again and kudos to you as well!
Kind Regards,
Assuming you have a Date table with a WeekNumber column, you should be able to use a measure like this that should give nonblank/shown values for the last 13 weeks.
NewMeasure =
VAR thisweek =
WEEKNUM ( TODAY () )
RETURN
CALCULATE (
[Your Measure],
KEEPFILTERS (
FILTER (
ALL ( 'Date'[WeekNumber] ),
'Date'[WeekNumber] <= thisweek
&& 'Date'[WeekNumber] >= thisweek - 12
)
)
)
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hello @mahoneypat
I have implemented your solution and thus far appears to be working exactly as I hoped. Still need to do a bit more testing and validation. But wanted to send along my thanks, appreciation and of course Kudos!
Best Regards,
Good Evening @mahoneypat
Thanks for the reply and suggested solution. I will give it a shot in the morning and let you know how I make out.
Thanks again and Best Regards,
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 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |