Syntax Error
Can someone help me with this formula? I need to show the number of X12_Month_Scheduled_Review__c - IF the Session_Date__c is THIS MONTH. Not all Session Dates will have a Scheduled Review Date.
IF(Session_Date__c
= 'THIS MONTH',
THEN(COUNT(X12_Month_Scheduled_Review__c
)))
Answers
-
@Stucker Domo does not have an IF function like in Excel, instead it uses CASE statements for logical operations (see this list of supported beast mode functions: https://domo-support.domo.com/s/article/360043429933?language=en_US). Also when aggregating data using a sum or count, it is generally better to put those outside of the case statement like below:
count(case when
Session_Date_c
= 'THIS MONTH' thenX12_Month_Scheduled_Review__c
end)0 -
@MichelleH - thank you for that information! Unfortunately the formula is not pulling in the correct count - its pulling in 0.. they are both date fields so I wonder if that has something to do with it?
0 -
@Stucker If they are both date fields, then we would need to set up the logic criteria to compare to the month and year of today's date. As it was written before, it would only count the
X12_Month_Scheduled_Review__c
field if theSession_Date_c
field contains the words “THIS MONTH”. Here is how you can rewrite it:count(
case
when
MONTH(Session_Date_c) = MONTH(CURRENT_DATE()) and YEAR(Session_Date_c) = YEAR(CURRENT_DATE())
then
X12_Month_Scheduled_Review__c
end
)
1 -
@MichelleH - Question for this one is there a way to rework this formula to only show when ‘Session_Date’ is this month and ‘X12_Month_Scheduled_Review__c’ IS NOT BLANK?
0 -
@Stucker The formula should already account for both of those criteria.
This checks whether the Session_Date_c field has the same month and year as today's date:
case
when
MONTH(Session_Date_c) = MONTH(CURRENT_DATE()) and YEAR(Session_Date_c) = YEAR(CURRENT_DATE())
For each row that meets the above condition (having a session date this month), it returns the
X12_Month_Scheduled_Review__c
field. Rows that do not meet the condition return a null value.then
X12_Month_Scheduled_Review__c
end
Rows where
X12_Month_Scheduled_Review__c
is null are NOT counted in theCOUNT()
function, so the result of the entire formula should only include rows where both criteria are met.If you formula is not calculating as expected, then it's possible that the
X12_Month_Scheduled_Review__c
field contains empty strings instead of null values, in which case you can add an additional condition to your formula:count(
case
when
MONTH(Session_Date_c) = MONTH(CURRENT_DATE()) and YEAR(Session_Date_c) = YEAR(CURRENT_DATE()) and X12_Month_Scheduled_Review__c <> ''
then
X12_Month_Scheduled_Review__c
end
)
1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 738 Beast Mode
- 56 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive