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
Anonymous
Not applicable

Ignore average if not available

Hi Guys,

I wan't to ignore an average which is calculated in a certain metric when there is no data available for a certain year for another metric. I have this matrix:

YearAvg1Avg2
2017 15
20181012
20191419
20201212
total1214.5

 

For my report, I'm calculating and presenting the overall difference between avg1 and avg2. What I wan't is when no data available for a certain year for avg1, don't calculate the average for avg2 (I'm not presenting the matrix, but only the overall). 15 is now influencing the overall comparison which is wrong.  How to solve this?


The measures I'm using the calculate the averages are pretty basic: sum(sales) / distinctcount(orderid)

4 REPLIES 4
gvrajesh
Frequent Visitor

Hi @Anonymous 

You can calculate Avg2 only when Avg1 is not blank using below logic

Avg2 = IF( ISBLANK(AVG1), BLANK(),sum(sales) / distinctcount(orderid))

i was thinking the same, but not too sure it will work when it calculates at the total level. as when the year context is removed [avg1] wont be blank so 2017 will be included? just thinking I could be wrong.

Hi @rfigtree 

Yes you are correct. To fix that we've to create virtual table like below

gvrajesh_0-1614946651347.png

 

cool, it is fun seeing peoples solutions on here. always learning something new.

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.

Top Solution Authors