Loading
Slack製品の問い合わせ先はSalesforce Helpへ統合・変更されます続きを読む

How to Display Record Counts for Each Item in a Color Legend

公開日: Oct 19, 2026
説明

How to display the number of records corresponding to each item in the color legend (e.g., "Blue : Positive 14 records").

解決策

Follow these steps to create the necessary calculated fields and configure the view.

  1. Create a base color determination field that returns a string based on categories or conditions. For example, name the field [Color Category] and enter the following calculation:
     IF SUM([Profit])>=0 THEN "Blue : Positive" ELSE "Red : Negative" END
  2. Create a calculated field for each category that returns 1 only if the condition is met.

    • For the positive count, create [Positive Count]:
      IF [Color Category]="Blue : Positive" THEN 1 END
    • For the negative count, create [Negative Count]:
      IF [Color Category]="Red : Negative" THEN 1 END
  3. Create a string concatenation field for the legend display. For example, name the field [Legend with Count]. Use the WINDOW_SUM function to sum the number of records across the view and concatenate it as a string.
    IF SUM([Profit])>=0 THEN

    [Color Category] + " " + STR(WINDOW_SUM([Positive Count])) + " records"

    ELSE

    [Color Category] + " " + STR(WINDOW_SUM([Negative Count])) + " records"

    END
  4. Drag the [Legend with Count] field to Color on the Marks card.
  5. Right-click the field, select Compute Using, and specify the appropriate dimension, such as Table (across) or Table (down).
 
その他のリソース

WINDOW_SUM is a table calculation function. The correct count may not be displayed immediately after placing it on the Marks card, but configuring the direction correctly using Compute Using will display the expected overall count.

For more information, see WINDOW_SUM.

 

ナレッジ記事番号

005461752

添付ファイル

sample.twbx

1154 KB

 
読み込み中
Salesforce Help | Article