Weird Sorting Issue - Total Sales
Hi, Experts,
I created a domo card in table view for some top-level KPIs. I am running into an issue when I sort by Total Sales (calculated field/beast mode) by ascending you get the column sorted by 0 to the bottom. When you sort by descending it sorts by blanks.
Thoughts or help would be greatly appreciated.
Comments
-
That's functioning as intended. NULLs always appear last. The actual data should appear after the nulls decending. What sort of behavior are you expecting?
If you want to override the sorting behavior you can utilize a separate beast mode to handle the nulls differently and sort based on this new field rather than the actual data field.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
@GrantSmith I have never attempted to do that. How would you do that? Can you provide an example how you would do a beast mode for the nulls as you mentioned?
0 -
You can update your calculated field to something like this:
case
when `Total Sales` is null then 0
else `Total Sales`
endIf you can share your `Total Sales` beast mode, I could give you a more concrete example
0 -
@ST_-Superman-_ has it correct. It's a simple case statement to handle the nulls and replace it with 0.
Depending on your aggregate level you may need to wrap it in a SUM() (or do this on the sorting section of the card building interface)
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
Here is the code - sorry for the delay.
SUM(CASE
WHEN `rpt_job.authorized` = 1
THEN (`rpt_job.subtotal_sales`) / 100
END)Thanks for your help in advance @ST_-Superman-_
1 -
You should just need a simple tweak to your case statement to include an ELSE clause:
SUM(CASE
WHEN `rpt_job.authorized` = 1
THEN (`rpt_job.subtotal_sales`) / 100
ELSE 0
END)**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
@imelendez ... Didn't I harp about null values in our work together? LOL
Domo does not handle nulls well. Get rid of them in your ETL before the card. Beast mode is fine in the interim, but you know I always want it firmly built in ETL if it can be.
DataMaven
Breaking Down Silos - Building Bridges
**Say "Thanks" by clicking a reaction 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.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive