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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors