この記事では、Salesforce レポートでよく使われる計算に対応した、すぐに使用できるレポート数式の例を紹介します。これらの数式は、レポートビルダーの [列を追加] → [数式] で直接使用できます。
対象機能: Lightning Experience および Salesforce Classic のサマリーレポート、マトリクスレポート、表形式レポート。
Salesforce レポートの数式では、特定の関数セットを使用します。スプレッドシートの数式とは異なり、レポートの数式は API 参照名でフィールドを参照し、集計項目 (グループレベルで計算) と行レベルの数式 (レコードごとに計算) の 2 種類があります。よくあるエラーの原因として、間違った種別を選択していることがあります。
使用事例: クローズまでの日数、最終活動日からの日数、またはレコードの経過日数を計算します。
種別: 行レベルの数式 | 戻り値のデータ型: Number
CloseDate - CreatedDateConvertedDate - CreatedDateROUND(CloseDate - CreatedDate, 0)使用事例: 外部システムでの使用や比較用に、18 文字の ID ではなく 15 文字の ID を表示します。
種別: 行レベルの数式 | 戻り値のデータ型: Text
LEFT(Id, 15)使用事例: 各行またはグループが総計に占める割合を表示します。少なくとも 1 つのグループを含むサマリーレポートが必要です。
種別: 集計項目 | 戻り値のデータ型: パーセント
RowCount / PARENTGROUPVAL(RowCount, GRAND_SUMMARY)RowCount を集計項目 (Amount__c:SUM など) に置き換えて、グループごとの収益の割合を計算します。使用事例: レコードをアルファベット順ではなく、時系列順 (月=1、火=2 など) で曜日ごとにグループ化または並べ替えます。
種別: 行レベルの数式 | 戻り値のデータ型: Number
CASE(MOD(ActivityDate - DATE(1900,1,7), 7), 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 0)使用事例: 完了済みの商談のうち、成約した商談の割合を計算します。フェーズまたは所有者でグループ化されたサマリーレポートが必要です。
種別: 集計項目 | 戻り値のデータ型: パーセント
ROUND(your_formula, 2) とすると、小数点以下 2 桁で表示されます。IF(condition, value_if_true, value_if_false)。複数の条件を指定する場合は、IF() をネストするか、CASE() 関数を使用してください。005385906

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.