March 31, 2023

Show Different Target Per Segment

 

A co-worker of mine asked how to show different target per segment. Here're the steps:


1) Create a sample chart that shows sales by region.


2) Create a 'Segment Param' parameter with segment values as well as 'All' for all segments.


3) Create a Boolean 'Segment Select' formula

[Segment] = [Segment Param] or [Segment Param] = 'All'


4) Drag the 'Segment Select' formula to the Filters pane and select 'True'.


5) Create a 'Target Values' formula that has different target for each segment.


6) Drag the 'Target Values' formula to the Detail Marks.

Important: Since Sales in Rows is continuous for this bar chart, make sure the 'Target Values' formula is also continuous. If it's discrete, it won't show up in the reference line.


7) Click on the Sales y-axis and select 'Add Reference Line'. In 'Value' box in the Line section, select 'Target Values'.


8) Finally, customize how you want the target to show by entering the values in the Line section.