cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AbbasG
Helper I
Helper I

Highlighting the max value (%) in a measure

Hello All,

I have data of suppliers with their regular prices and MSRP. I have created a measure that calculates % difference on regular prices with MSRP as a base value.

Now I want to highlight the row with the highest % difference. Please help me on how can calculate the same.

My data looks like below.

AbbasG_0-1639379045118.png

 

1 ACCEPTED SOLUTION

Hi @AbbasG ,

 

I modified my color measure. Please take a look.

Color = 
VAR _rank =
    RANKX (
        FILTER (
            ALLSELECTED ( 'All suppliers Combined Data' ),
            [Model#] = MAX ( 'All suppliers Combined Data'[Model#] )
        ),
        [Min of MSRP % difference from Min of Price],
        ,
        DESC,
        DENSE
    )
RETURN
    IF ( _rank = 1, "Green", "White" )

vstephenmsft_1-1640074883003.png

 

 

Best Regards,

Stephen Tao

 

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

 

View solution in original post

9 REPLIES 9
amitchandak
Super User
Super User

@AbbasG ,

Highest Diff percent 

overall = calculate(maxx(summarize(allselected(Table) , Table[Supplier], Table[Model], " _1", [Diff]) , [_1] ) )


Max By supplier = calculate(maxx(summarize(Table , Table[Supplier], " _1", [Diff]) , [_1] ), removefilters(Table[Model] ))

Max By supplier = calculate(maxx(summarize(Table , Table[Model], " _1", [Diff]) , [_1] ), removefilters(Table[Supplier] ))

 

 

Use one of them as per need to compare and create color measure  

 

Color =  Switch( True() ,

[Diff %] = [Overall] , "Green" ,"White")

 

And use that in coditional formatting using field value option 

 

How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4



New Power BI Features
Datamarts: https://youtu.be/8tskWsJTEpg
Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin !! Proud to be a Super User!
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
!! Subscribe to my youtube Channel !!

Hello @amitchandak 

 

Thank you for the quick response. I have created the below measures. But it highlights all the value, can you please guide me what goes wrong?
Max By supplier = calculate(maxx(summarize(Table , Table[Supplier], " _1", [Diff]) , [_1] ), removefilters(Table[Model] ))

 

 

Color =  Switch( True() ,

[Diff %] = [Overall] , "Green" ,"White")







@AbbasG , I think I should not have removed model from summarize

 

Max By supplier = calculate(maxx(summarize(Table , Table[Supplier],Table[Model] " _1", [Diff]) , [_1] ), removefilters(Table[Model] ))

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.



New Power BI Features
Datamarts: https://youtu.be/8tskWsJTEpg
Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin !! Proud to be a Super User!
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
!! Subscribe to my youtube Channel !!

@amitchandak Awaiting your help, please😅

Hi @AbbasG ,

 

Is this the desired result you want?

vstephenmsft_0-1639990057972.png

Color measure is as follows.

Color =
VAR _rank =
    RANKX (
        FILTER (
            ALLSELECTED ( 'All suppliers Combined Data' ),
            [Supplier] = MAX ( 'All suppliers Combined Data'[Supplier] )
        ),
        [Min of MSRP % difference from Min of Price],
        ,
        DESC,
        DENSE
    )
RETURN
    IF ( _rank = 1, "Green", "White" )

 

 

Best Regards,

Stephen Tao

 

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

Hi @v-stephen-msft thank you for your response.

I want to highlight only the max % diff in each row. 



Hi @AbbasG ,

 

I modified my color measure. Please take a look.

Color = 
VAR _rank =
    RANKX (
        FILTER (
            ALLSELECTED ( 'All suppliers Combined Data' ),
            [Model#] = MAX ( 'All suppliers Combined Data'[Model#] )
        ),
        [Min of MSRP % difference from Min of Price],
        ,
        DESC,
        DENSE
    )
RETURN
    IF ( _rank = 1, "Green", "White" )

vstephenmsft_1-1640074883003.png

 

 

Best Regards,

Stephen Tao

 

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

 

@v-stephen-msft This helps. Thank you so much 🙂

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors