Loading

Conditionally Color View by Each Value or All Values Combined

Publiceringsdatum: Feb 23, 2026
Uppgift
How to color marks differently for each dimension member, or another non-segmented color when all dimension members are shown in the view
Steg
The attached example workbook uses the sample data set Superstore to demonstrate the following directions:
  1. Drag [Region] to the Columns shelf
  2. Drag [Sales] to the Rows shelf
  3. Drag [Profit] over the axis for Sales and drop the field
  4. Move [Measure Names] from the Columns shelf to Color on the Marks card
  5. Create a calculated field with a name like "All or each segment color" with a calculation similar to the following:

    IF { FIXED : COUNTD([Segment])} = {EXCLUDE [Segment] : COUNTD([Segment])}
    THEN "All"
    ELSE [Segment]
    END

    Note: The FIXED expression will always return the total unique count of segments no matter how the view is filtered. The EXCLUDE expression will return the unique count of segments in the view based on how the view is filtered. It is necessary to exclude [Segment] otherwise each mark in the view will return 1 (since each bar segment only has one value of [Segment])

  6. Shift-drag [All or each segment color] to Color.
Ytterligare resurser
It will be necessary to change the [Segment] filter and manually set the color for that filter selection. And then repeat this process for every possible [Segment] filter selection.
Knowledge-artikelnummer

001453816

Bilagor

example all or one segment color.twbx

2443 KB

 
Laddar
Salesforce Help | Article