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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Create a measure for relative error with values in same column, for different categories

 

Hello, I need help with a measure for a Relative Error 

%Prediction could be created with method A or B and there's a Base Method. So, for month 1,2, and son on, i need relative error between method A and Base (PRediction with method A  - Prediction with Base method) / Prediction with Base method. 

For january and method A:  (20%-22%)/22%  = -9,1% 

For method B, same thing:   (Prediction with method B  - Prediction with base method) / Prediction with base method

so for january and method B: (21%-22%)/22% = -4,5%

 

Relative error for base method shoud be Zero or Null, it would be plotted later.

 

How can i create this with DAX? i imagine i must create some sort of index. Any guide to achieve this? Many thanks in advance as usually 

 

 

Date / MonthMethod% Prediction%Relative Error (desire result)
01-01-2022A20%-9,1%
01-02-2022A23%-4,2%
01-03-2022A26%-3,7%
01-01-2022B21%-4,5%
01-02-2022B22%-8,3%
01-03-2022B28%3,7%
01-01-2022Base22%                             -
01-02-2022Base24%                             -
01-03-2022Base27%                             -
1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Thanks for reaching out to us.

try this measure

Relative Error = 
 var _base= MAXX(FILTER(ALL('Table'),'Table'[Date / Month]=MIN('Table'[Date / Month]) && 'Table'[Method]="Base"),[% Prediction])
 return ([% Prediction]-_base)/_base

vxiaotang_0-1667460566241.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thank you a lot!!! it worked! 🤗 

v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Thanks for reaching out to us.

try this measure

Relative Error = 
 var _base= MAXX(FILTER(ALL('Table'),'Table'[Date / Month]=MIN('Table'[Date / Month]) && 'Table'[Method]="Base"),[% Prediction])
 return ([% Prediction]-_base)/_base

vxiaotang_0-1667460566241.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi! sorry to ask again, it worked, i was just wondering if you can explain what the formula is doing?. I'm not understanding logic behind DAX and i'd like to improve my reports by understanding it better. 

What does MAXX and MIN like in few words, i get that you filtered BASE but i dont get that MAXX and min part.

Thank you

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.