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 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 -
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
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
- Data Connections
- 1.3K Connectors
- 309 Workbench
- 17 Cloud Integrations
- Data & ETL
- 2.3K Magic ETL
- 120 SQL DataFlows
- 667 Datasets
- Visualize & Apps
- 90 App Studio
- 198 Pro-code Components
- 2.6K Charting & Analyzer
- 873 Calculations & Variables (Beast Mode)
- AI & Data science
- 23 Domo AI & AI Chat
- 4 Managing AI
- 18 Jupyter Workspaces
- Automate
- 122 Workflows
- Alerts
- Distribute
- 118 Domo Everywhere
- 284 Reporting
- Manage
- 145 Governance & Security
- 489 APIs
- 11 Add-ins & Plugins
- 13 Domo Community Gallery
- 49 Product Releases
- 13 Domo University
- Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 118 Community Announcements
- 5K Archive