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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
yonk
Regular Visitor

Last 12 months average

Hi,

 

I am trying to calculate average last 12 months debtor days.

 

The step by step calculation is:

A. average last 3 months sales

B. debtor closing balance

C. days in count

D. debtor days for the month = ( B / (A/C))

E. debtor days last 12 months = average of D for past 12 months.

 

Now I have got A through D measures working but unable to get a measure working for E.

 

Because A through D are all measures I couldn't simply use sum(D, datesbetween). Couldn't figure out an alternative.

 

Thanks for helping

Regards,

Yon

 

1 ACCEPTED SOLUTION

@yonk , I think this type of measure should work

 

Rolling 12 = calculate(AverageX(Values('Date'[MONTH Year]),[Debtor Days]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

 

You can check for number of month to only get it when 12 months are there

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

4 REPLIES 4
yonk
Regular Visitor

Hi @amitchandak ,

 

I might not have explained myself clearly so I have screenshot a replicate in excel.

Basically my DAX formula in PowerBI is at the top (highlighted green & working fine) but I'm scratching my head on what the DAX formula needs to be for G(yellow highlighted). In simple terms, G needs to be a rolling 12 months average of F. I don't think the suggested formula gave me that answer.

yonk_2-1656593065636.png

 

 

Thanks for the help

Regards,

yonk

 

 

 

@yonk , I think this type of measure should work

 

Rolling 12 = calculate(AverageX(Values('Date'[MONTH Year]),[Debtor Days]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

 

You can check for number of month to only get it when 12 months are there

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thank you very much this seems to work!

amitchandak
Super User
Super User

@yonk , if you need sum till month level and then take Average then

 

example

 

Rolling 12 = calculate(AverageX(Values('Date'[MONTH Year]),CALCULATE(sum(Sales[Sales Amount]))),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

 

Rolling Months Formula: https://youtu.be/GS5O4G81fww

Average of Rolling, Average of Snapshots: https://youtu.be/_pZRdLAJxxA

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.