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.
Hello,
I am looking to figure out a calulation that can average out the ticket count within the last 4 weeks referring back to the current date. In my sample data, I have already figured out a method, but it doesn't seem to be the best way in my opinion. So in my mind, the calulation should be something like averagex, but referring to a VAR going back to the last 4 weeks. In my sample data, I also have a fiscal calendar showing the fiscal week number.
I have some sample data posted in the link below.
https://1drv.ms/u/s!AqID1H0nHPOzg3iZ797Q6uCBtmV9?e=8RbbLj
Solved! Go to Solution.
I guess 52.50 is the correct expected result. You cannot use dates function because the fiscal week is custom assigned start from Feb. So you can only filter the fiscal week column with custom expression.
ast 4 Wks Ave Tickets per Week = CALCULATE(
AVERAGEX(VALUES( 'Calendar'[Fiscal Week] ), [Total Tickets] ),
FILTER('Calendar',
'Calendar'[Fiscal Week]<CALCULATE(MAX('Calendar'[Fiscal Week]),FILTER('Calendar',[Date]=TODAY()))
&& 'Calendar'[Fiscal Week]>=CALCULATE(MAX('Calendar'[Fiscal Week]),FILTER('Calendar',[Date]=TODAY()))-4))
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
I guess 52.50 is the correct expected result. You cannot use dates function because the fiscal week is custom assigned start from Feb. So you can only filter the fiscal week column with custom expression.
ast 4 Wks Ave Tickets per Week = CALCULATE(
AVERAGEX(VALUES( 'Calendar'[Fiscal Week] ), [Total Tickets] ),
FILTER('Calendar',
'Calendar'[Fiscal Week]<CALCULATE(MAX('Calendar'[Fiscal Week]),FILTER('Calendar',[Date]=TODAY()))
&& 'Calendar'[Fiscal Week]>=CALCULATE(MAX('Calendar'[Fiscal Week]),FILTER('Calendar',[Date]=TODAY()))-4))
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
@romoguy15
-28 days is one the correct option to filter. But the confusion is what do you mean by last 4 weeks from current date. It has to be very clear.
Do you mean last 3 week + this week until today(if today is 40 week's Wednesday, you want 37,38,39, 40 until Wednesday OR last 4 weeks excluding this week (if this week is 40, you want 36,37,38,39).
Paul
Hello Paul, it would be last 4 weeks excluding this week. Sorry for not explaining clearly. I know that the way I currently have it calculated is not correct since I am counting back 28 days. But the ideal and correct method of what I would like is last 4 weeks excluding this week.
@romoguy15 , refer if my week vs week blog can help
Columns
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
measures
This Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Last year Week= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52)))
Last 8 weeks = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])-8 && 'Date'[Week Rank]<=max('Date'[Week Rank])))
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
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 |
---|---|
113 | |
97 | |
80 | |
69 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |