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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply

Dax code check

Hi

 

I have written this dax that gives me an indication when a value is bigger/smaller than the average. Now, I've adjusted the dax so that I get a warning when a value is 0.5% bigger/smaller than the average. 

 

It seems to do the job, but can someone have a check if this is correct? 

 
KPI UG =
 
Var _AverageByCat = CALCULATE(AVERAGE(W_MW_6[(MW_6)]),
ALLEXCEPT(W_MW_6[UG],W_MW_6[Year]))
 
return // _AverageByCat
IF(W_MW_6[(MW_6)] >= (_AverageByCat + 0.005), UNICHAR(128905), BLANK())

 

1 ACCEPTED SOLUTION

@jochendecraene Well that just checks if the current value is above .5% of the average, not if the value is .5% below the average. I would suggest using a SWITCH(TRUE(), ...) statement or you could do it via this:

IF(W_MW_6[(MW_6)] >= (_AverageByCat + 0.005) || W_MW_6[(MW_6)] <= (_AverageByCat - 0.005, UNICHAR(128905), BLANK())


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@jochendecraene I don't see how this handles the smaller than .5% of average case.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I thought I handled it by simpling adding 0.005 by the average?

 

IF(W_MW_6[(MW_6)] >= (_AverageByCat + 0.005), UNICHAR(128905), BLANK())

@jochendecraene Well that just checks if the current value is above .5% of the average, not if the value is .5% below the average. I would suggest using a SWITCH(TRUE(), ...) statement or you could do it via this:

IF(W_MW_6[(MW_6)] >= (_AverageByCat + 0.005) || W_MW_6[(MW_6)] <= (_AverageByCat - 0.005, UNICHAR(128905), BLANK())


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Yes, I see 

 

thnx!!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.