Comparative Gage - What's wrong with my query?
Using the Comparative Gauge,
I wanted to display our performance by whether the number of impressions have increased or decreased.
Only, when I use the following window functions, I get a blank card with a downward arrow.
Current Month:
sum(case when MONTH(`Created Time`) = MONTH(CURRENT_DATE()) then `Likes`+`Shares`+`Comments` end)
Previous Month:
sum(case when MONTH(DATE_ADD(`Created Time`, interval 1 month)) = MONTH(CURRENT_DATE()) then `Likes`+`Shares`+`Comments` end)
What I want to do is capture the sum of the previous month in a beastmode, then capture the sum of the current month. Only, the issue arises when I realize that the values will be smaller since the current month is not complete. So I would need to capture where we are at now in comparison to the previous month.
Is this possible?
Answers
-
If you are adding together multiple values and one of them is blank or null, it will not be able to add them all together and just produce a blank value. You would need to do this: IFNULL(likes,0) + IFNULL(shares,0) + IFNULL(comments,0) in order to add them together. If the fields aren't actually null, but blanks, you would need to do CASE statements around them as well to replace that with zero. I find it easier to clean these types of data issues in the ETL so then my beast mode is easier to read.
Also, to deal with the the incomplete months, you can add the DAY function just like you did the MONTH function but say when it is <= instead of = to.
Hope this helps.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.3 -
Thanks for your input, I'll need to double check to see if i changed my blank null or blank values to 0.
That may be a step I neglected to remember.
I'll get back to you if this resolves my issue.
1 -
So there are nulls in my data but I still can't get it work.
0
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