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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Determine if value is greater between a list of numbers

Currently trying to determine the best way to find out if other values in a list are greater than a declared variable.

 

For example, we have 2020 Q2 in the database set as 202002 (a numeric value), this is followed by 202001, 201904, 201903, and so on. These all have differeing values, and I want to be able to check if the value for 202002 is higher than those before. The data I have looks like this:

lxtrxi_0-1598358632006.png

There are four items being pulled through, the rows are RecordID & Quarter while the column is Name and the values being pulled through are StandardResult. You can see here that 202002 is not the highest, and 201801 is - I've highlighted this as blue to show how the anticipated end-result should work.

 

I've tried to write something with what knowledge I have but it doesn't seem to resolve. Is there a way to take the numeric value of 202002, set it as a variable to check all other values in this list? Is there a way to make a list of items, excluding 202002 and checking all other values against this?

3 ACCEPTED SOLUTIONS
Fowmy
Super User
Super User

@Anonymous 

You can add this measure to identify the highest in the range

M = 
IF(
    SELECTEDVALUE(Table3[RESULT]) = 
    CALCULATE(
        MAX(Table3[RESULT]),
        ALLSELECTED(Table3[QTR])
    ),
    1,
    0
)

 

________________________

If my answer was helpful, please mark this post as a solution, this will also help others!.

Click on the Thumbs-Up icon if you like this reply 🙂



YouTube
LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

Anonymous
Not applicable

Hi @Fowmy, thanks for your message. I've taken the information you have passed over but ran into a snag. It shows a 1 value against all of the results, shown below:

lxtrxi_0-1598361187836.png

It is possible I've made an error in the code somewhere. The 1.00 & 2.00 values are the StandardResults, the Quarter is 202001, 02, etc. I've moved these around a fair bit to see if I can fix it but it either shows them all as 1 or all as 0, whereby the only one that should show as a 1 is the orange highlighted field.

CheckHighestInRange = 
IF (
    SELECTEDVALUE ( ALLUNITS[StandardResult] )
        = CALCULATE (
            MAX ( ALLUNITS[StandardResult] ),
            ALLSELECTED ( ALLUNITS[Quarter] )
        ),
    1,
    0
)

 Can you see where my error is with this?

View solution in original post

@Anonymous 

Check the attached file and compare it with yours.
You can download the file: HERE


Fowmy_0-1598362978945.png

________________________

If my answer was helpful, please mark this post as a solution, this will also help others!.

Click on the Thumbs-Up icon if you like this reply 🙂



YouTube
LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

6 REPLIES 6
Fowmy
Super User
Super User

@Anonymous 

You can add this measure to identify the highest in the range

M = 
IF(
    SELECTEDVALUE(Table3[RESULT]) = 
    CALCULATE(
        MAX(Table3[RESULT]),
        ALLSELECTED(Table3[QTR])
    ),
    1,
    0
)

 

________________________

If my answer was helpful, please mark this post as a solution, this will also help others!.

Click on the Thumbs-Up icon if you like this reply 🙂



YouTube
LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Hi @Fowmy, thanks for your message. I've taken the information you have passed over but ran into a snag. It shows a 1 value against all of the results, shown below:

lxtrxi_0-1598361187836.png

It is possible I've made an error in the code somewhere. The 1.00 & 2.00 values are the StandardResults, the Quarter is 202001, 02, etc. I've moved these around a fair bit to see if I can fix it but it either shows them all as 1 or all as 0, whereby the only one that should show as a 1 is the orange highlighted field.

CheckHighestInRange = 
IF (
    SELECTEDVALUE ( ALLUNITS[StandardResult] )
        = CALCULATE (
            MAX ( ALLUNITS[StandardResult] ),
            ALLSELECTED ( ALLUNITS[Quarter] )
        ),
    1,
    0
)

 Can you see where my error is with this?

@Anonymous 

Try that one as a measure.

If you need to add as a column then,

CheckHighestInRange Col = 
IF (
     [RESULT] 
        = CALCULATE (
            MAX ( Table3[RESULT] ),
            ALLSELECTED (Table3[QTR],Table3[RESULT] )
        ),
    1,
    0
)



________________________

If my answer was helpful, please mark this post as a solution, this will also help others!.

Click on the Thumbs-Up icon if you like this reply 🙂



YouTube
LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmy 

 

What do you mean sorry? This is saved as a measure already, am I misunderstanding this?

@Anonymous 

Check the attached file and compare it with yours.
You can download the file: HERE


Fowmy_0-1598362978945.png

________________________

If my answer was helpful, please mark this post as a solution, this will also help others!.

Click on the Thumbs-Up icon if you like this reply 🙂



YouTube
LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Thanks @Fowmy it looks to be data related in my instance, I can see yours works as expected so I will need to take a look at the information my report is pulling through.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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