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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
DIFF1
Helper II
Helper II

Formula to sort by accuracy (absolute error)

Hello everyone, 

 

I need some help.  Any advice will be appreciated, especially if someone can explain. 

 

I have such a visualization. 

 

Issue1.jpg

 

I need to sort by lowest forecast accuracy. By saying this, I need to somehow take the forecast accuracy of 100% as the best one and to rank the ratio of Accuracy considering that items can be over and under forecasted. So 100.20 and 99.80 basically show that there is an error of 0.20% and it should be considered similar level issue. 

 

Measure of Accuracy is 1-(FCST-ACTUALS)/FCST 

 

Does someone know how i can sort it taking into consideration this absolute error...

 

 

1 ACCEPTED SOLUTION

@DIFF1 Why not something using absolute value? Like:

 

Error = ABS([Accuracy] - 1)

 

 

View solution in original post

6 REPLIES 6
DIFF1
Helper II
Helper II

@ebeery you know. It works. Thank you very much!

DIFF1
Helper II
Helper II

@ebeery  Thank you very much for your reply. 

 

I am not sure but something is totally wrong, it doesn't calculate correctly. That's what I have now. 

 

 

Issue1.jpg

 

Calculation for Accuracy

 

DIFF1_0-1640054973012.png

 

And calculation for Error

 

DIFF1_1-1640055021645.png

 

 

@DIFF1 What do you mean by "it doesn't calculate correctly"?  What is the actual result you are expecting?  It seems to me like it is operating as intended - the are sorted by worst to best accuracy.  To see the most accurate values just sort in ascending order.

DIFF1
Helper II
Helper II

@ebeery  Thank you very much. But the first step is how to basically let PowerBI know that 100.01 accuracy and 99.99 accuracy is basically a mistake of 0.01 so that it is treated as the same mistake? That is the biggest issue for me. I don't understand how it can be done.

@DIFF1 Why not something using absolute value? Like:

 

Error = ABS([Accuracy] - 1)

 

 

ebeery
Solution Sage
Solution Sage

@DIFF1 assuming that you don't want the absolute error to be shown in the visual, the only way I'm aware of with a table/matrix visual is described in the 2nd part of the article below.   Basically involves creating a measure for sorting, adding to the visual, and adjusting the column width such that the column is no longer visible.

https://pbivisuals.com/2021/03/03/power-bi-sorting-data-by-a-column-not-shown-in-visual/ 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors