The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I am trying to assign different colors for different states dependent if they have the functions or not (DE, DR, PCC are the functions).
Example - 1 color would be states AL, GA, HI, MS, NE (they have zero across the board)
Example 2 color would be DE, ME, MN (they only have zeros PCC)
Example 3 color would be KY (has zero in DE and PCC)
Example 4 color would be all the rest of the states (they have values in each of the functions)
Solved! Go to Solution.
Hi @jcastr02 ,
Based on your description, it appears that you want to classify states into groups based on specific conditions and then apply unique color codes to those groups. Here is a step-by-step approach to accomplish this in Power BI:
StateCategory =
VAR DE_Value =
MAX ( 'Table'[DE_Column] )
VAR DR_Value =
MAX ( 'Table'[DR_Column] )
VAR PCC_Value =
MAX ( 'Table'[PCC_Column] )
RETURN
SWITCH (
TRUE (),
DE_Value = 0
&& DR_Value = 0
&& PCC_Value = 0, "Color1",
DE_Value = 0
&& DR_Value = 0
&& PCC_Value > 0, "Color2",
DE_Value = 0
&& DR_Value > 0
&& PCC_Value = 0, "Color2",
DE_Value = 0
&& DR_Value > 0
&& PCC_Value > 0, "Color3",
DE_Value > 0
&& DR_Value = 0
&& PCC_Value = 0, "Color3",
DE_Value > 0
&& DR_Value = 0
&& PCC_Value > 0, "Color4",
DE_Value > 0
&& DR_Value > 0
&& PCC_Value = 0, "Color4",
DE_Value > 0
&& DR_Value > 0
&& PCC_Value > 0, "Color5",
"other"
)
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @jcastr02 ,
Based on your description, it appears that you want to classify states into groups based on specific conditions and then apply unique color codes to those groups. Here is a step-by-step approach to accomplish this in Power BI:
StateCategory =
VAR DE_Value =
MAX ( 'Table'[DE_Column] )
VAR DR_Value =
MAX ( 'Table'[DR_Column] )
VAR PCC_Value =
MAX ( 'Table'[PCC_Column] )
RETURN
SWITCH (
TRUE (),
DE_Value = 0
&& DR_Value = 0
&& PCC_Value = 0, "Color1",
DE_Value = 0
&& DR_Value = 0
&& PCC_Value > 0, "Color2",
DE_Value = 0
&& DR_Value > 0
&& PCC_Value = 0, "Color2",
DE_Value = 0
&& DR_Value > 0
&& PCC_Value > 0, "Color3",
DE_Value > 0
&& DR_Value = 0
&& PCC_Value = 0, "Color3",
DE_Value > 0
&& DR_Value = 0
&& PCC_Value > 0, "Color4",
DE_Value > 0
&& DR_Value > 0
&& PCC_Value = 0, "Color4",
DE_Value > 0
&& DR_Value > 0
&& PCC_Value > 0, "Color5",
"other"
)
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
141 | |
109 | |
107 | |
75 | |
62 |
User | Count |
---|---|
276 | |
129 | |
124 | |
100 | |
89 |