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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Using a measure to get the second highest value - complementary suppression

Hi All,

 

I'm in need of creating a measure that will be able to calculate the second highest value (after 5) in a column and then apply it in another measure..

 

Some context I need to suppress values less than 5 in the display.. however because there is a total showing if there is only 1 value suppressed per a user selection.. the measure needs to then adjust to suprress up to the next smallest value.. (called complimentary suppression)

 

I have a measure that can verifies that there is only one value being suppressed in the series [Needs Compliment].. However I'm having trouble capturing the next smallest value beyond 5:

 

Suppression = if(
       [ComplimentNeeded] = "Needs Compliment", //if compliment needed
          if(SUM(TestData[TestNumbers]) < [Next Smallest], "Suppressed With Compliment", //If less than next smallest              SUM(TestData[TestNumbers]), //Otherwise Sum
           if(SUM(TestData[TestNumbers]) < 5, "<5", SUM(TestData[Variable 2]))) //Otherwise apply normal suppression

 

I've been trying to use the rank function however that gives me literally the second largest rather than the next smallest larger than 5..

 

Because this all needs to be dynamic to user selection I can't use calculated columns unfortunatley.. 

Any help is hugely appreciated!!

4 REPLIES 4
Anonymous
Not applicable

Clarification

 

Rank actually will work.. because if there is only one value suppressed.. therefore requiring compliment.. the next value would be larger than 5..

 

Here is the measure I'm using to determine the second value: 

NextSmallest = MINX( FILTER(VALUES(TestData[TestNumbers]), RANKX(VALUES(TestData[TestNumbers]), CALCULATE(MAX(TestData[TestNumbers])),,ASC) = 2),
CALCULATE(MAX(TestData[TestNumbers])))

However when I use this formula in the [Suppression] measure originally posted.. it doesn't work because it tries to break the [NextSmallest] measure down see below table example:
Capture.JPG
As you can see the Next Smallest measure is accuratley calculating the next smallest value is 3.. However I only see it as a total so the Suppression isn't actually doing anything..

Hi @Anonymous ,

Thank your for your clarification firstly.

I still have a little confused about your requirement.

If it is convenient, could you share your data sample which could reproduce your scenario and your desired output so that we could help further on it.

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi v-piga-msft

I was actually finally able to figure it out.. I appreciate your follow up!

So my goal was to "suppress" the next smallest value in the series when it would otherwise only suppress a single value.. when shown with a total could be easily reverse engineered..

 

Example series: 10, 4, 7

Suppression Criteria: any value less than 5

So in this case with regular suppression we get: 10, <5, 7.. if shown with the total of 21 it wouldn't take much to figure out what the <5 represents.


Using the Rank function we can apply an asecending order to the series like so:

10 : 3
4   : 1
7   : 2

Next we use an if statement that evaluates when the Rank is "2" checking for if the corresponding value is greater than or less than 5.. If the value is greater than 5 we need complimentary suppression, if it is less than 5 it would be suppressed so we don't need to worry.

Here is the final output:
10,
<5,
Complimentary Suppressed

Now this paired with the total cannot (easily) be reverse engineered for the individual values.


Could you post the dax code? I need to do the same. Thank you

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.