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

Compare a measure with column values and conditional format

Hi all,

 

Below is a view that I bring in to a 'table view' in PBI. 'Current_Value' (Table A) is a measure and 'HI HI(red)' (Table B) is a columnar value. I want a logic that compares If Current_ValueHI HI(red), then Current_Value should be color coded to red, else green.

 

I am guessing I have to use the summarize function or values, but can't seem to get the syntax right. Any thoughts?

 


image.png

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Re: Compare a measure with column values and conditional format

Hey,

 

from my understanding you should rewrite the measure like so:

 

Conditional_Value = If(HASONEVALUE('Table A'[NAME]),
IF(
    [Current_Value]>SUM('Table B'[HI HI (red)])
    , "#FF0000"
    , "#008000"
)
)

Regards,

Tom

 

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!

View solution in original post

5 REPLIES 5
Super User III
Super User III

Re: Compare a measure with column values and conditional format

Hey,

 

can you please prepare a pbix wiht some sample data, upload the pbix to onedrive or dropbox and share the link.

 

But in the meantime this might also help: https://community.powerbi.com/t5/Desktop/Using-IF-Statement-for-Date-to-Separate-Dollar-Amounts-in-o...

 

Regards,

Tom

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!
atulj10 Helper I
Helper I

Re: Compare a measure with column values and conditional format

Hi Tom,

 

ConditionalTest.pbix

Please find the link attached.

 

Just to show what I am trying, here is a DAX that is giving me syntax error:

Conditional_Value = If(HASONEVALUE('Table A'[NAME]),
SWITCH(VALUES('Table A'[NAME]),
[Current_Value]>SUM('Table B'[HI HI (red)]), "#FF0000",
[Current_Value]>SUM('Table B'[HI HI (red)]),"#008000"
)
)
Super User III
Super User III

Re: Compare a measure with column values and conditional format

Hey,

 

from my understanding you should rewrite the measure like so:

 

Conditional_Value = If(HASONEVALUE('Table A'[NAME]),
IF(
    [Current_Value]>SUM('Table B'[HI HI (red)])
    , "#FF0000"
    , "#008000"
)
)

Regards,

Tom

 

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!

View solution in original post

atulj10 Helper I
Helper I

Re: Compare a measure with column values and conditional format

My god! That was literally my first attempt, but I was formatting it incorrectly!! Thank you so much!!

Super User III
Super User III

Re: Compare a measure with column values and conditional format

Smiley Wink

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Top Solution Authors
Top Kudoed Authors