Forum Discussion
DikshaT
3 years agoRegular Visitor
Need 'Total' in Bar/Waterfall chart with Dynamic Semantical Color
Hello, I want to have Grant Total in the Bar/waterfall chart at last of all the values. And I want to set same semantic color setting to the Total also like other fields (Green if quantity measure i...
CodeDriven
1 year agoNew Member
For those of you still looking for a solution:
I found a way to do it using the "Simple Waterfall" visual and applying dynamic formatting to the bar color.
Scenario:
Imagine you have a date column as the category (e.g., "Dim_Date"[Date]) and a measure ("YourMeasure") as the value.
Steps:
Disable Sentimental Coloring
- Turn off any default coloring options to ensure your custom colors are applied correctly.
Create a Dynamic Color Measure
Add a new measure to your report, that checks whether it is a total by using the property of selected Date(s):
Bar Color = VAR IsTotal = IF( HASONEVALUE('Dim_Date'[Date]), FALSE(), -- Regular column TRUE() -- Total column ) RETURN IF( IsTotal, -- Logic for total column IF( [YourMeasure] >= 0, "#006400", -- Dark green for positive totals "#8B0000" -- Dark red for negative totals ), -- Logic for individual columns IF( [YourMeasure] >= 0, "#5CE65C", -- Light green for positive values "#FF2C2C" -- Light red for negative values ) )Apply Dynamic Coloring
- Go to your chart’s Visual Element > Bar Colors.
- Select the fx button for data colors.
- Choose Format by: Field value and select your Bar Color measure.
Final Outcome:
This approach ensures:
- Total column:
- Dark green for positive totals.
- Dark red for negative totals.
- Regular columns:
- Light green for positive values.
- Light red for negative values
Hope this helps!