Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

DAX for 4 week Run Rate

Hi,

 

Trying to find the right Dax to use to create a 4 week run rate as a measure rather than a calculated column.

 

Have tried 

 

4wk RR Qty Sales:=(CALCULATE(SUM(FactSales[Qty Sales]),DATESINPERIOD(DimCalendar[Date],max(DimCalendar[Date]),-28,DAY)))/4

 

This seems to work however any total of say a month will still give the value of the last week in the month.

 

Any help??

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Could you show an example expected output?

 

Let to say, today is 2019/4/3, if "FactSales" only have sales till today, then

"4wk RR Qty Sales" for today should be 

(the sum for 2019/3/7~2019/4/3)/4

there are four weeks from 2019/3/7~2019/4/3

 

"4wk RR Qty Sales" for 2019/4/2 should be 

(the sum for 2019/3/6~2019/4/2)/4

 

Is my understanding correct?

 

Best Regards

Maggie

 

Anonymous
Not applicable

Hi Maggie


That is exactly the output I would be after.

 

Only addtional consideration would be that the sales data may go past this period but we would want to run a report for the week ending the 2019/4/3.  so it that report we may show the sales for that week and also the 4wk RR as at that weeek.

 

Hope that makes sense.

 

Thanks for your help 🙂

Hi @Anonymous 

Sorry, i don't understand this correctly.

"Only addtional consideration would be that the sales data may go past this period but we would want to run a report for the week ending the 2019/4/3.  so it that report we may show the sales for that week and also the 4wk RR as at that weeek"

Could you show an example? Is my understanding below right?

For example, in 2019/4/3, "4wk RR Qty Sales" of your formula would calcuate sum/4 for period "2019/3/7~2019/4/3",

But you have data in 2019/4/4, 2019/4/5 too, then you want  new "4wk RR Qty Sales" calculate (the sum for 2019/3/11~2019/4/7)/4?

 

Best Regards

Maggie

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.