BeastMode code to take one value from each category
This question is going to be really difficult to describe, but I will try anyway.
I am trying to get a unit count for each facility, the problem is that bc we filter by time and different facilities can gain units over time, I can not just have one row per facility, I have a row for each month. That being said I need it to pull the unit count just from the final row available per facility.
Image 1: This is the graph I am trying to get to work
Image 2: How the data categories are set up the name column represents each facility. I will refer to the name column as the facility column going forward
Image 3: Data categories cont. (Ignore occupancy columns).
I need to pull just one units value per facility category, I tried setting it to average, but it takes the average for the whole state which is wrong. There are typically 3 or 4 facilities per state. I need the state name to be states or the card doesnt work.
Image 4: Here you can see the discrepancy, the unit count by state should always equal the units gauge. But I can not figure out how to get the state value to only pull one value per facility, while being able to keep the state name to the states.
Best Answer
-
If you are statically setting the filter and will have to change it each month you should be able to do it dynamically by creating a beast mode that looks something like this:
CASE WHEN datefield = MAX(datefield) THEN 'Include' ELSE 'Exclude' END
Drag this beast mode into your filters and filter to Include.
**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.0
Answers
-
Is the same dataset powering your "Units" gauge as the map? If the goal is to get the same number to appear on both that and the map card, a good place to start would be what is different about those two cards
Please 💡/💖/👍/😊 this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
0 -
@DavidChurchman So the difference between the two is the Units data set only has one entry per facility, it does not have to worry about the time filter like the states card does. I know why they are different, but I can not normalize that as I need to keep the months filter working on the states card, but not the units card. While setting the units gauge to the states data set would display the same number. Instead of one being right and one being wrong, they would both be wrong.
My question isnt as much about setting them equal to eachother, but its about making the states card pull only one value per facility. Preferably the most recent value available based on the time filter set. But having it be stuck on the Q2-24 also works as a temporary bandaid, until i figure out how to make it work with the time filter.
0 -
I figured it out, I set a filter to the last month available within the actual card. Not great but better than nothing. Open to other suggestions, as of right now it wont let me look at unit counts in other months without breaking it.
0 -
If you are statically setting the filter and will have to change it each month you should be able to do it dynamically by creating a beast mode that looks something like this:
CASE WHEN datefield = MAX(datefield) THEN 'Include' ELSE 'Exclude' END
Drag this beast mode into your filters and filter to Include.
**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.0 -
@MarkSnodgrass Thank you so much that is a much better solution
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
- 737 Beast Mode
- 55 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