FIXED Function with filter on card
Hi All
I'm sure this has been asked a few times but I couldn't find a specific answer that helped with my challenge
I have a PIVOT Table which contains all of my financial data rows consisting of Costs and Revenues
I want to calculate a share of revenue for each cost whilst having a filter on my card to remove the Revenue line however when I filter out revenue all the shares drop to 0
I've not used FIXED functions to level before so could use some help and guidance on how to show share of revenue % on my table and filter out the revenue row
Thanks
Dan
Best Answer
-
The fixed function in Beast Mode lets you compute a value across a fixed level of aggregation, ignoring filters on specific rows. Using a beast mode to represent Total Revenue (fixed)
FIXED (SUM(CASE WHEN `Type` = 'Revenue' THEN `Amount` ELSE 0 END))
and use that in another formula for % Share
CASE
WHEN `Type` = 'Cost' THEN `Amount` / FIXED (SUM(CASE WHEN `Type` = 'Revenue' THEN `Amount` ELSE 0 END))
ELSE NULL
ENDFilter out Type = 'Revenue' and the table should show cost rows.
Cost Category
Amount
% of Revenue
Labor
50,000
10.0%
Software
25,000
5.0%
Btw, I don't have any sample data created to confirm this works.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Answers
-
The fixed function in Beast Mode lets you compute a value across a fixed level of aggregation, ignoring filters on specific rows. Using a beast mode to represent Total Revenue (fixed)
FIXED (SUM(CASE WHEN `Type` = 'Revenue' THEN `Amount` ELSE 0 END))
and use that in another formula for % Share
CASE
WHEN `Type` = 'Cost' THEN `Amount` / FIXED (SUM(CASE WHEN `Type` = 'Revenue' THEN `Amount` ELSE 0 END))
ELSE NULL
ENDFilter out Type = 'Revenue' and the table should show cost rows.
Cost Category
Amount
% of Revenue
Labor
50,000
10.0%
Software
25,000
5.0%
Btw, I don't have any sample data created to confirm this works.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
Hi @ArborRose, I had to move the FIXED function to the end of the BM as it returns a syntax error when placed at the start.
Also, when I filter out the 'Type' = Revenue on the table itself, the BM show 0 for everything which I know is incorrect
Incidentally, the one I've created is no good as it naturally ignores filters so my calculation is showing a much lower % than it should when I use said filters.
Is there a way to create a fixed revenue based on selected YEAR and selected MONTH as these are 2 separate slicers allowing users to choose a combination of YEAR and MONTH independently
Thanks
Dan
0 -
I don't typically work with FIXED, so we're traveling outside my knowledge zone. It might help to post it as a new question with anonymized sample data in csv.
I think what you want is something like a fixed revenue across year and month like thisFixed Revenue by Year-Month:
FIXED (BY `Year`, `Month`) SUM(
CASE WHEN `Type` = 'Revenue' THEN `Amount` ELSE 0 END
)And a calculated field to get the percent share
CASE WHEN `Type` = 'Cost' THEN
`Amount` / `Fixed Revenue by Year-Month`
ELSE
NULL
END** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Categories
- All Categories
- Product Ideas
- 2.1K Ideas Exchange
- Connect
- 1.3K Connectors
- 309 Workbench
- 7 Cloud Amplifier
- 10 Federated
- Transform
- 663 Datasets
- 119 SQL DataFlows
- 2.3K Magic ETL
- 823 Beast Mode
- Visualize
- 2.6K Charting
- 86 App Studio
- 46 Variables
- Automate
- 193 Apps
- 483 APIs & Domo Developer
- 87 Workflows
- 23 Code Engine
- AI and Machine Learning
- 23 AI Chat
- 4 AI Projects and Models
- 18 Jupyter Workspaces
- Distribute
- 117 Domo Everywhere
- 283 Scheduled Reports
- 11 Software Integrations
- Manage
- 143 Governance & Security
- 11 Domo Community Gallery
- 49 Product Releases
- 13 Domo University
- Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 116 Community Announcements
- 5K Archive