具有多个标准的 Salesforce 字段计算

发布于 2025-01-20 14:46:44 字数 450 浏览 2 评论 0原文

我正在尝试提出一个公式,该公式将根据“入学队列城市”名称在“偏移字段”中进行计算。

由于某种原因,公式使用 100 减去所有行的记录数。

我目前的公式: IF(Placement__c.Enrollment__c.Cohort_City__c ="Online",RowCount - 100,RowCount - 45)

用最简单的术语来说,我需要根据多个条件从记录计数中减去偏移列。

纽约需要一个 45 减去“记录数”的公式,

在线效果很好。 100 减去记录数 = -89

纽约需要一个公式,将 46 减去“记录数”

在此处输入图像描述

I am trying to come up with a formula that will give a calculation in the "Offset Field" based on The "Enrollment Cohort City" name.

For some reason the formula is using 100 to minus record count for all rows.

My Current Formula:
IF(Placement__c.Enrollment__c.Cohort_City__c ="Online",RowCount - 100,RowCount - 45)

In the simplest terms I need to have the offset column subtract from the record count based on multiple conditions.

New York needs a formula that will be 45 minus "record count"

Online works fine. 100 minus record count = -89

New York needs a formula that will be 46 minus "record count"

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伪心 2025-01-27 14:46:45

通常我会使用 CASE 函数,但是看起来它在汇总级别公式中表现得很有趣。要么只返回默认子句,要么抱怨类型不匹配。

RowCount - CASE(Placement__c.Enrollment__c.Cohort_City__c,
'New York', 46,
'Online', 100,
45)

尝试通过制作辅助行级公式来作弊。

这是我的标准“产品机会”报告,其中包含标准数据,您可以在 Developer Edition、Trailhead Playground、Scratch 组织(您知道,“伯灵顿纺织品”、“亚利桑那大学”、“联合石油天然气公司”等)中找到。按帐户结算城市分组(因此它应该符合您的情况,opp 订单项 -> opp -> 帐户)。

假装第一行显示“在线”

[在此处输入图像描述

首先,我创建了名为“城市偏移量”的行级公式
类型 = 数字,小数点后 0 位。这就是我想要的 CASE

CASE(ADDRESS1_CITY,'Austin',100,'New York',46,45)

当你对它进行分组时,SF很可能会显示该字段的SUM,我们不希望这样。要么根本不显示该字段,要么选择 AVG/MIN/MAX。我选择了 MAX,所以我的表格列标题显示“最大...”

在此处输入图像描述

一旦您对行级公式感到满意,请添加最终的汇总级计算。对我来说是 CDF1:MAX - RowCount,您的字段名称可能有所不同。使其类似于:

在此处输入图像描述

Normally I'd use CASE function but looks like it behaves funny in summary level formulas. Either returns just the default clause or complains about type mismatch.

RowCount - CASE(Placement__c.Enrollment__c.Cohort_City__c,
'New York', 46,
'Online', 100,
45)

Try to cheat by making a helper row-level formula.

Here's my standard "Opportunities with Products" report on standard data you can find in Developer Edition, Trailhead playground, scratch orgs (you know, "Burlington Textiles", "University of Arizona", "United Oil & Gas" etc). Grouped by Account billing city (so it should match your situation, opp line item -> opp -> account).

Pretend 1st row says "Online"

[enter image description here

First I created row level formula called "city offset"
Type = number, 0 decimal places. So that's the CASE I wanted

CASE(ADDRESS1_CITY,'Austin',100,'New York',46,45).

When you group it SF is likely to display SUM of this field, we don't want that. Either don't display the field at all or pick AVG/MIN/MAX. I've went with MAX so my table column's header says "Largest..."

enter image description here

Once you're happy with the row-level formula add your final summary-level calculation. For me it was CDF1:MAX - RowCount, your field names may differ. Make it similar to this:

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文