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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Paulyeo11
Impactful Individual
Impactful Individual

My traffic light color shown wrong

Hi All

 

Color_GP =
VAR _variance_per_country =
[GP% YTD]
RETURN
SWITCH (
TRUE (),
_variance_per_country < 0.15 && _variance_per_country >= -100, "#D64550",
_variance_per_country < 0.4 && _variance_per_country >= 0.15, "#E8D166",
_variance_per_country <= 10 && _variance_per_country >=0.4, "#79FF00",
"#00000")

 

Paulyeo11_0-1607866405387.png

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @Paulyeo11 

Download the PBIX file with working CF rules

You don't need to create a separate measure for this, you can format the conditional formatting rules directly for GP% Variance 

bg-cf.png

 

cf-rules-bg.png

 

Same for the font

cf-rules-font.png

 

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!


View solution in original post

9 REPLIES 9
PhilipTreacy
Super User
Super User

HI @Paulyeo11 

I'm confused, maybe others are too.

Your initial post showed a measure being created based on the value of [GP% YTD] and the image showed [GP% VARI] being conditionally formatted based on the result of that new measure.

Is this what you want?  To format [GP% VARI]  based on the value of [GP% YTD] ?

Or do you want [GP% VARI] formatted based on it's own value?

Either way you don't need to create a new measure, you can set your conditional formatting rules as I've shown.

FWIW, the final value in the SWTCH statement is missing a 0, the hex colour value should be "#000000"

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!


amitchandak
Super User
Super User

@Paulyeo11 , it should be

Color_Sales = 
VAR _variance_per_country =
[Sales Vari %]
RETURN
SWITCH (
TRUE (),
_variance_per_country < 0  , "red",
_variance_per_country < 0.2 && _variance_per_country >= 0, "green",
_variance_per_country <= 10 && _variance_per_country >=0.2, "yellow",
"#00000"
)

 

or

Color_Sales = 
VAR _variance_per_country =
[Sales Vari %]
RETURN
SWITCH (
TRUE (),
_variance_per_country < 0  , "red",
_variance_per_country < 0.2 && _variance_per_country >= 0, "yellow",
_variance_per_country <= 10 && _variance_per_country >=0.2, "green",
"#00000"
)

 

Find the file attached

Hi Amit

 

i just check both of your expression not work , for example if you notice that below table i need all -ve value show in red color. now some show red color only.

 

Paulyeo11_0-1607910122563.png

 

@Paulyeo11 , Your color formula is on sales Var % not on GP Var %. You can change the column in Var as per need

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
PhilipTreacy
Super User
Super User

Hi @Paulyeo11 

Download the PBIX file with working CF rules

You don't need to create a separate measure for this, you can format the conditional formatting rules directly for GP% Variance 

bg-cf.png

 

cf-rules-bg.png

 

Same for the font

cf-rules-font.png

 

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!


Hi Phil

Thank you very much for give me detail step , first time i ever try using this apporach , it work

Paul

negi007
Community Champion
Community Champion

@Paulyeo11  I will suggest you another way of doing it, you first create a measure that will be used for color coding like below.  You can change or modify the condition as per your requirment.

 

Color_Code =


if (and([GP% YTD] < .15,[GP% YTD] >= -100), 1,
if(and([GP% YTD] < .4,[GP% YTD] >= 0.15), 2,
if(and([GP% YTD] < 10,[GP% YTD] >= 0.4), 3 ,
4)
)
)

 

 

Once you create above measure, you can then use above result in the conditional formatting. Conditional formatting in the matrix will change as per the result of the measure created above.




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

Paulyeo11
Impactful Individual
Impactful Individual

Hi Neg

Thank you for your sharing. 

I try to follow your approach , but then i am not able to select  the field and move the condition format.

https://www.dropbox.com/s/zv46wuy115fo8a8/PB_TDS_V100%20ask%20GP%20TRAFFICE%20LIGHT.pbix?dl=0

My PBI fle at able link

Paul 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.