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
stherkildsen
Frequent Visitor

Take average of a calculated measure.

So the measure i have attached is a measure that takes the average for the last 12 month. So e.g for  february it takes the last 12 month before and creates an average of that. This has worked fine so far. But now a new department is added (PIM). This department only has observation 3 month back, which will create a wrong average because its divded by 12. Instead i want it to be divided by 3, but the other departments should be an yearly average. Is this possible? 

stherkildsen_1-1612446065873.png

stherkildsen_2-1612446141527.png

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@stherkildsen , Try a measure like given example

 

Rolling 12 Avg = divide( CALCULATE(sum(Sales[Sales]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date]),-12,MONTH)) ,
CALCULATE(distinctCOUNT('Date'[Month Year]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH), not(isblank((Sales[Sales])))))

 

not isblank is important to force count of available data

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@stherkildsen , Try a measure like given example

 

Rolling 12 Avg = divide( CALCULATE(sum(Sales[Sales]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date]),-12,MONTH)) ,
CALCULATE(distinctCOUNT('Date'[Month Year]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH), not(isblank((Sales[Sales])))))

 

not isblank is important to force count of available data

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.