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.
Hi all,
I'm hoping someone can help, I've been trying to Create a measure to work out an average of a column which has 1 & 0 over a 28 day period so when this is grouped by month or week in a matrix it would average the column
Average over 28 day period = VAR LAST_DATE = FIRSTDATE( 'Query1'[ORDERDATE].[Date]) RETURN AVERAGEX( DATESBETWEEN( 'Query1'[ORDERDATE].[Date], LAST_DATE, DATEADD(LAST_DATE,28,DAY) ), CALCULATE(AVERAGE('Query1'[Call Driver])) )
This was my last attempt to create a measure.
as a calculated column, I would have used this
Average over 28 days = VAR 28daysafter = [ORDERDATE] + 28 VAR IDtoCheck = [AGENTID] RETURN CALCULATE ( AVERAGE(Query1[Call Driver]), ALL(Query1), 'Query1'[AGENTID] = IDtoCheck, Query1[ORDERDATE]+1 <= 28daysafter )
Any help would be appreciated
Thanks
Liam
Solved! Go to Solution.
Hi LRiley,
According to your description, it seems that you want to calculate rolling average based on month and id, right? If so, you could try to use below measure to see whether it work or not
rolling sum = CALCULATE ( SUM ( avg28[amount] ), FILTER ( ALL ( avg28 ), avg28[date] <= MIN ( avg28[date] ) + 28 && avg28[date] >= MIN ( avg28[date] ) && avg28[id] = MIN ( avg28[id] ) && avg28[month] = MIN ( avg28[month] ) ) ) rolling avg = [rolling sum]/28
If this is not what you want, please correct me and inform me more detailed information(such as your sample data and expecting output), then I will help you more correctly.
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi LRiley,
According to your description, it seems that you want to calculate rolling average based on month and id, right? If so, you could try to use below measure to see whether it work or not
rolling sum = CALCULATE ( SUM ( avg28[amount] ), FILTER ( ALL ( avg28 ), avg28[date] <= MIN ( avg28[date] ) + 28 && avg28[date] >= MIN ( avg28[date] ) && avg28[id] = MIN ( avg28[id] ) && avg28[month] = MIN ( avg28[month] ) ) ) rolling avg = [rolling sum]/28
If this is not what you want, please correct me and inform me more detailed information(such as your sample data and expecting output), then I will help you more correctly.
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
111 | |
94 | |
83 | |
66 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |