Forum Discussion
Conditional colour format Bar chart
Hi All,
Please suggest measure to combine multiple statements of conditional colour format into one, currently my bar chart toggle between 3 options using slicer.
How to use single condition to colour bars when toggle between slicer options?
IF(TABLE[Act v. LY (Top 10 Bar chart)] < 1, "#FF0000", "#00CC66")
IF(TABLE[Act v. Bud (Top 10 Bar chart)] < 1, "#FF0000", "#00CC66")
IF(TABLE[Act v. Fcst (Top 10 Bar chart)] < 1, "#FF0000", "#00CC66")
Field paramater:
Hi SnagalapurThank you for reaching out to the Microsoft Fabric Forum Community.
Can you try below DAX
Bar Chart Color Format =
VAR SelectedKPI = SELECTEDVALUE('KPI''s'[KPI's]) -- This refers to the field parameter slicer
VAR KPIValue =
SWITCH(
SelectedKPI,
"Act v. Bud", [Act v. Bud (Top 10 Bar chart)],
"Act v. Fcst", [Act v. Fcst (Top 10 Bar chart)],
"Act v. LY", [Act v. LY (Top 10 Bar chart)],
BLANK()
)
RETURN
IF(KPIValue < 1, "#FF0000", "#00CC66")
If this information is helpful, please “Accept as solution” to assist other community members in resolving similar issues more efficiently.
Thank you.
7 Replies
- bhanu_gautamSuper User
Snagalapur , You can create a measure using SWITCH
DAX
ColorMeasure =
SWITCH(
TRUE(),
SELECTEDVALUE(Slicer[Selection]) = "Act v. LY" && TABLE[Act v. LY (Top 10 Bar chart)] < 1, "#FF0000",
SELECTEDVALUE(Slicer[Selection]) = "Act v. LY" && TABLE[Act v. LY (Top 10 Bar chart)] >= 1, "#00CC66",
SELECTEDVALUE(Slicer[Selection]) = "Act v. Bud" && TABLE[Act v. Bud (Top 10 Bar chart)] < 1, "#FF0000",
SELECTEDVALUE(Slicer[Selection]) = "Act v. Bud" && TABLE[Act v. Bud (Top 10 Bar chart)] >= 1, "#00CC66",
SELECTEDVALUE(Slicer[Selection]) = "Act v. Fcst" && TABLE[Act v. Fcst (Top 10 Bar chart)] < 1, "#FF0000",
SELECTEDVALUE(Slicer[Selection]) = "Act v. Fcst" && TABLE[Act v. Fcst (Top 10 Bar chart)] >= 1, "#00CC66",
"#000000" // Default color if none of the conditions are met
)- SnagalapurHelper IV
Thank you for details. currently i'm facing below error , could you please suggest, currently i'm using calculated measures in slicer as parameters.
- AnonymousNot applicable
Please share some sample data and show which fields are placed in the bar chart and in the field parameter?
- v-priyankataCommunity Support
Hi Snagalapur
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.