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
admin11
Memorable Member
Memorable Member

How to make Rev go is good and Exp go up is bad ?

Hi All

i have Table which display Rev & Exp in one table .

I can make Rev go up display VARI % green 

but I cannot make Exp go up display VARI % Red

See image below 

https://www.dropbox.com/s/0069e5bwamsh93k/IMG_5663.PNG?dl=0

Paul

2 ACCEPTED SOLUTIONS
DataZoe
Employee
Employee

@admin11 I would try creating another measure to use for the conditional formatting:

 

CF for Table =

if(selectedvalue('Table'[ITEM])="Rev",[Vari NP %],
if(selectedvalue('Table'[ITEM])="COGS",[Vari NP %]*-1,

blank()))

 

then in the conditional formatting use this one as your range with the diverging option on, making the center 0.

 

DataZoe_0-1614788226585.png

 

 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

View solution in original post

v-alq-msft
Community Support
Community Support

Hi, @admin11 

 

Based on your descritpion, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

b1.png

 

Measure1:

Measure1 = SUM('Table'[Value1])

 

Measure2:

Measure2 = SUM('Table'[Value2])

 

Vari %:

Vari % = 
DIVIDE(
    [Measure2]-[Measure1],
    [Measure1]
)

 

You may create a measure as below.

Color Control = 
var val = 
SWITCH(
    SELECTEDVALUE('Table'[Item]),
    "Rev",[Measure2]-[Measure1],
    "Exp",[Measure1]-[Measure2]
)
return 
IF(
    val>0,
    "green",
    IF(
        val<0,
        "red"
    )
)

 

Then you need to conditionally format 'Vari %' based on 'Color Control'.

b2.png

 

Result:

b3.png

 

Best Regards

Allan

 

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

5 REPLIES 5
v-alq-msft
Community Support
Community Support

Hi, @admin11 

 

Based on your descritpion, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

b1.png

 

Measure1:

Measure1 = SUM('Table'[Value1])

 

Measure2:

Measure2 = SUM('Table'[Value2])

 

Vari %:

Vari % = 
DIVIDE(
    [Measure2]-[Measure1],
    [Measure1]
)

 

You may create a measure as below.

Color Control = 
var val = 
SWITCH(
    SELECTEDVALUE('Table'[Item]),
    "Rev",[Measure2]-[Measure1],
    "Exp",[Measure1]-[Measure2]
)
return 
IF(
    val>0,
    "green",
    IF(
        val<0,
        "red"
    )
)

 

Then you need to conditionally format 'Vari %' based on 'Color Control'.

b2.png

 

Result:

b3.png

 

Best Regards

Allan

 

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

@v-alq-msft 

Thank you very much

DataZoe
Employee
Employee

@admin11 I would try creating another measure to use for the conditional formatting:

 

CF for Table =

if(selectedvalue('Table'[ITEM])="Rev",[Vari NP %],
if(selectedvalue('Table'[ITEM])="COGS",[Vari NP %]*-1,

blank()))

 

then in the conditional formatting use this one as your range with the diverging option on, making the center 0.

 

DataZoe_0-1614788226585.png

 

 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

PhilipTreacy
Super User
Super User

@admin11 

Hi Paul,

Can you link to your PBIX please.

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


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.

Top Solution Authors