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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Joey_
Frequent Visitor

Rolling average not working for all days after slicing clients

Hello!

I have created a measure to calculate the rolling average of the money flow from my company's funds over the last 30 days, it works beautifully, and the calculation is done for everyday. But the problem is that after slicing clients, the calculation is no longer done for every day, but only for the dates when that particular client had impact on the money flow. This reduces the usability of the rolling average chart, i only want the money flow to be sliced by client, not the dates in which the calculation is being done. Here is the code from my measure: 

m_MedMov 30 =

var first_date = CALCULATE(FIRSTDATE('d_Calendario'[Date]), FILTER(ALL('d_Calendario'), [money_flow] <> BLANK()))

var rolling_sum = CALCULATE([money_flow], DATESINPERIOD('d_Calendario'[Date], LASTDATE('d_Calendario'[Date]), - 30, DAY)

return

IF(SELECTEDVALUE('d_Calendario'[Date]) > first_date + 30 && SELECTEDVALUE('d_Calendario'[Date]) <= MAX('d_Calendario'[Date]), rolling_sum / 30, BLANK())

Can anyone please shed some light on wether there is a solution for this?

2 REPLIES 2
Greg_Deckler
Super User
Super User

@Joey_ Try: Better Rolling Average - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Thanks a lot for the suggestion, but that does not solve my problem. I need the rolling average to be calculated for every single day, regardless of data slicing.

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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