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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors