Filtering null values on a card
I have beastmodes to calculate change in margin over years and I am trying to filter out when all three columns are null to keep only active fields. ( If one column has a change then all three columns should show) only filter when all three are null.
I made a beastmode but it seems to be giving me some trouble.
Answers

They are fairly long which could be causing the issue...
Change in Margin  2020 to 2021:
(SUM(CASE WHEN YEAR(`Period Date.1`) = YEAR(SUBDATE(CURDATE(), interval 1 year)) AND MONTH(`Period Date.1`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date.1`) < DAYOFYEAR(CURDATE()) THEN `Net Sales Amount` END)

SUM(CASE WHEN YEAR(`Period Date`) = YEAR(SUBDATE(CURDATE(), interval 1 year)) AND MONTH(`Period Date`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date`) < DAYOFYEAR(CURDATE()) THEN `Amount` END))
/
SUM(CASE WHEN YEAR(`Period Date.1`) = YEAR(SUBDATE(CURDATE(), interval 1 year)) AND MONTH(`Period Date.1`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date.1`) < DAYOFYEAR(CURDATE()) THEN `Net Sales Amount` END)

(SUM(CASE WHEN YEAR(`Period Date.1`) = YEAR(SUBDATE(CURDATE(), interval 2 year)) AND MONTH(`Period Date.1`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date.1`) < DAYOFYEAR(CURDATE()) THEN `Net Sales Amount` END)

SUM(CASE WHEN YEAR(`Period Date`) = YEAR(SUBDATE(CURDATE(), interval 2 year)) AND MONTH(`Period Date`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date`) < DAYOFYEAR(CURDATE()) THEN `Amount` END))
/
SUM(CASE WHEN YEAR(`Period Date.1`) = YEAR(SUBDATE(CURDATE(), interval 2 year)) AND MONTH(`Period Date.1`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date.1`) < DAYOFYEAR(CURDATE()) THEN `Net Sales Amount` END)
Change in Margin  2021 to 2022:
((CASE WHEN `Net Sales`= 'Net Sales' THEN SUM(CASE WHEN YEAR(`Period Date`) = YEAR(SUBDATE(CURDATE(), interval 1 day)) AND MONTH(`Period Date`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date`) <= DAYOFYEAR(CURDATE()) THEN `Net Sales Amount` END) END)

(CASE WHEN `cost type`= 'COGS' THEN SUM(CASE WHEN YEAR(`Period Date`) = YEAR(SUBDATE(CURDATE(), interval 1 day)) AND MONTH(`Period Date`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date`) <= DAYOFYEAR(CURDATE()) THEN `Amount` END) END))
/
(CASE WHEN `Net Sales`= 'Net Sales' THEN SUM(CASE WHEN YEAR(`Period Date`) = YEAR(SUBDATE(CURDATE(), interval 1 day)) AND MONTH(`Period Date`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date`) <= DAYOFYEAR(CURDATE()) THEN `Net Sales Amount` END) END)

(SUM(CASE WHEN YEAR(`Period Date.1`) = YEAR(SUBDATE(CURDATE(), interval 1 year)) AND MONTH(`Period Date.1`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date.1`) < DAYOFYEAR(CURDATE()) THEN `Net Sales Amount` END)

SUM(CASE WHEN YEAR(`Period Date`) = YEAR(SUBDATE(CURDATE(), interval 1 year)) AND MONTH(`Period Date`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date`) < DAYOFYEAR(CURDATE()) THEN `Amount` END))
/
SUM(CASE WHEN YEAR(`Period Date.1`) = YEAR(SUBDATE(CURDATE(), interval 1 year)) AND MONTH(`Period Date.1`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date.1`) < DAYOFYEAR(CURDATE()) THEN `Net Sales Amount` END)
Change in Margin  2020 to 2022:
((CASE WHEN `Net Sales`= 'Net Sales' THEN SUM(CASE WHEN YEAR(`Period Date`) = YEAR(SUBDATE(CURDATE(), interval 1 day)) AND MONTH(`Period Date`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date`) <= DAYOFYEAR(CURDATE()) THEN `Net Sales Amount` END) END)

(CASE WHEN `cost type`= 'COGS' THEN SUM(CASE WHEN YEAR(`Period Date`) = YEAR(SUBDATE(CURDATE(), interval 1 day)) AND MONTH(`Period Date`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date`) <= DAYOFYEAR(CURDATE()) THEN `Amount` END) END))
/
(CASE WHEN `Net Sales`= 'Net Sales' THEN SUM(CASE WHEN YEAR(`Period Date`) = YEAR(SUBDATE(CURDATE(), interval 1 day)) AND MONTH(`Period Date`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date`) <= DAYOFYEAR(CURDATE()) THEN `Net Sales Amount` END) END)

(SUM(CASE WHEN YEAR(`Period Date.1`) = YEAR(SUBDATE(CURDATE(), interval 2 year)) AND MONTH(`Period Date.1`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date.1`) < DAYOFYEAR(CURDATE()) THEN `Net Sales Amount` END)

SUM(CASE WHEN YEAR(`Period Date`) = YEAR(SUBDATE(CURDATE(), interval 2 year)) AND MONTH(`Period Date`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date`) < DAYOFYEAR(CURDATE()) THEN `Amount` END))
/
SUM(CASE WHEN YEAR(`Period Date.1`) = YEAR(SUBDATE(CURDATE(), interval 2 year)) AND MONTH(`Period Date.1`) <= MONTH(SUBDATE(CURDATE(), interval 1 day)) AND DAYOFYEAR(`Period Date.1`) < DAYOFYEAR(CURDATE()) THEN `Net Sales Amount` END)
0 
@mhouston I did a test with this beast mode and the logic seemed to work as expected so I think you are on the right track. It is essentially the same is as what you described but without the actual margin calculations.
case when `margin1` is null and `margin2` is null and `margin3` is null then 'filter out' else 'keep' end
It may be worth rebuilding the query again to make sure that it was compiled correctly. You should be able to plug in the margin calcs into the parenthesis below and try it.
case when (20202021 code here) is null and (20212022 code here) is null and (20202022 code here) is null then 'filter out' else 'keep' end
**Say “Thanks" by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"0
Categories
 All Categories
 1.1K Product Ideas
 1.1K Ideas Exchange
 1.2K Connect
 966 Connectors
 254 Workbench
 Cloud Amplifier
 1 Federated
 2.4K Transform
 75 SQL DataFlows
 499 Datasets
 1.8K Magic ETL
 2.7K Visualize
 2.2K Charting
 360 Beast Mode
 19 Variables
 483 Automate
 101 Apps
 378 APIs & Domo Developer
 6 Workflows
 22 Predict
 6 Jupyter Workspaces
 16 R & Python Tiles
 316 Distribute
 64 Domo Everywhere
 252 Scheduled Reports
 59 Manage
 59 Governance & Security
 1 Product Release Questions
 5K Community Forums
 37 Getting Started
 23 Community Member Introductions
 63 Community Announcements
 4.8K Archive