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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
jcast
Frequent Visitor

Total Average Measure based on parameters from another measure

The Measure is for each individual month is working correctly, but the total is calculating the average for every month.

 

I need to calculate the total average based on a criteria set by another measure.  Only average the months that have a value for the referenced measure.  I have used filters to exlude those values, I have use summarize and I still cannot get the correct total average.

 

WOEX =
//REFERENCE VALUE
var ttL = CALCULATE(SUMX(oge,OGE[Value]), FILTER(OGE, OGE[Cat] ="xloe" && OGE[Category] = "8/8THS TTL LEASE OPERATING EXP"))

// CALCULATE ONLY MONTHS THAT HAVE A VALUE FOR CORREPONDING REFERENCE VALUE
var surf = CALCULATE(AVERAGE(OGE[Value]), FILTER(oge, OGE[Cat] = "woe" && OGE[Category] = "SURFACE REPAIRS AND MAIN"&& ttl <> 0))

Return
CALCULATE(AVERAGEX(SUMMARIZE(OGE, Account_id[account_id]),surf), FILTER(OGE,ttl<>0))
 
Result Table:
 
 
 
 
 
 
 
 
2021-01-20_16-14-59.png

268.77 is the average for all months. The correct answer I'm looking for is 358.36.

1 ACCEPTED SOLUTION
jcast
Frequent Visitor

I solved it.

 

For what ever reason the two measure where not seeing the realtionship to one another, so instead I created a calculated column for TTL and filtered the new measure to where TTL <> 0 and it corrected it.

View solution in original post

2 REPLIES 2
jcast
Frequent Visitor

I solved it.

 

For what ever reason the two measure where not seeing the realtionship to one another, so instead I created a calculated column for TTL and filtered the new measure to where TTL <> 0 and it corrected it.

wdx223_Daniel
Super User
Super User

WOEX =AVERAGEX(VALUES([Month]),
//REFERENCE VALUE
var ttL = CALCULATE(SUMX(oge,OGE[Value]), FILTER(OGE, OGE[Cat] ="xloe" && OGE[Category] = "8/8THS TTL LEASE OPERATING EXP"))

 

// CALCULATE ONLY MONTHS THAT HAVE A VALUE FOR CORREPONDING REFERENCE VALUE
var surf = CALCULATE(AVERAGE(OGE[Value]), FILTER(oge, OGE[Cat] = "woe" && OGE[Category] = "SURFACE REPAIRS AND MAIN"&& ttl <> 0))

 

Return
CALCULATE(AVERAGEX(SUMMARIZE(OGE, Account_id[account_id]),surf), FILTER(OGE,ttl<>0)))

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors