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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
steven_dot
Regular Visitor

Extract a benchmark figuere from column and compare to the rest of the same column

Hello, 

 

Thank you for reading this post and please allow me to explain my problem and hopefully you can help. 

 

I have a data set with two columns. In every data set there is a 'benchmark' figure I need to compare this benchmark to the other values and apply some if logic to see how far the difference is from the benchmark.

 

You will see from the data below (left side) that I have to compare each value to the benchmark and then give an output based on some rules (right side). The middle section is how I see the problem working. This would be to 1st compare each row with the benchmark and then apply to the if logic to see how large the difference is from the benchmark. Depending on the size of the differecne and if positive of negative a value would be applied.

 

Please see an example data set below and thank you very much

 

     
ProductSales BenchmarkDifferenceOutput RulesOutput
Umbrella9 10-12 If greater than + 24
Chair10 1002 If between 1 & 23
Table14 1044 If between 1 -& -1 2
Stool7 10-30 If between -1 & -21
Benchmark12 1021 If lower than - 20
1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @steven_dot ,

 

Create a Calculated Column

 

Final Score =

var _diff = 'Table'[Sales] - 'Table'[Benchmark]

RETURN
SWITCH(
True(),
 
_diff > 2 , 4,
_diff <=2 && _diff >1 ,3,
_diff <=1 && _diff >-1 , 2,
_diff <=-1 && _diff >-2 , 1,
0
 
)
 
 
1.jpg
 
 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

5 REPLIES 5
harshnathani
Community Champion
Community Champion

Hi @steven_dot ,

 

Create a Calculated Column

 

Final Score =

var _diff = 'Table'[Sales] - 'Table'[Benchmark]

RETURN
SWITCH(
True(),
 
_diff > 2 , 4,
_diff <=2 && _diff >1 ,3,
_diff <=1 && _diff >-1 , 2,
_diff <=-1 && _diff >-2 , 1,
0
 
)
 
 
1.jpg
 
 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

hello,

 

Thank you very much for your reply. That is very helpful!

 

First, there was an error in the dataset the benchmark is in the last row should be '10' and not '12'. The issue I have is that I don't have the 'Benchmark' column already . How do I create this from the 'benchmark' row and then applying this to all row, thus creating the 'benchmark' column which I can compare?

 

Thank you very much

 

 

Hi @steven_dot ,

 

Sorry, i did not understand by what you mean to create  a benchmark column.

 

You can add it to the dataset when you load data in Power BI or you can create a column from example.

 

1.jpg2.JPG

 

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Thank you so much - you're a hero

Hi @steven_dot ,

 

Thanks 🙂

 

If my answer  is a solution to the problem posted, please mark it as solution.

 

Thanks

Harsh

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors