Dynamic CAGR formula?

I know how to do a basic CAGR formula between two static years:
power((sum(CASE WHEN Fiscal Year = 2024 THEN Amount else 0 end)
/ sum(case when Fiscal Year = 2020 then Amount end)), 1 / 4)
-1
Is there a way to construct a CAGR calculation that responds to user filtering or changing the timeframe? I am trying to think of a way to make it so a user can choose a different start and end year and have it calculate the CAGR correctly.
Best Answer
-
Hello @ccccc4,
It's a bit complicated and I'll try to explain in detail how I approached this. First, I've created a Variable for the Start Period as follows:
I applied the same process for the CAGR end period, defining the start and end years for the calculation. Using these variables, I calculated the CAGR with the following formula:
Power(
(SUM(CASE WHENParts Kits Fiscal Year
=SEG PKA CAGR End Period
THENParts Kits Qty
END)
/
SUM(CASE WHENParts Kits Fiscal Year
=SEG PKA CAGR Start Period
THENParts Kits Qty
END))
,1/(SEG PKA CAGR End Period
-SEG PKA CAGR Start Period
+1))-1On the dashboard, you can set the CAGR calculation period (I know, I also hate the decimal in the year).
This automatically calculates the CAGR for the 2019–2023 period in the following graph:
If you found this post helpful, please use 💡/💖/👍/😊 below! If it solved your problem, don't forget to accept the answer.
1
Answers
-
VARIABLES!!!
Beast of a topic, so I'll defer to Domo's existing knowledge base - see link below.
It's kind of a Beastmode for Beastmodes (BeastModes^2???)
This should get you were you want to be - let me know if I misunderstood
✅Did this solve your problem? Accept it as a solution!
❤️Did you love this answer? Mark it as "Awesome"!
👍Do you agree with this process? Click "Agree"!
0 -
Hello @ccccc4,
It's a bit complicated and I'll try to explain in detail how I approached this. First, I've created a Variable for the Start Period as follows:
I applied the same process for the CAGR end period, defining the start and end years for the calculation. Using these variables, I calculated the CAGR with the following formula:
Power(
(SUM(CASE WHENParts Kits Fiscal Year
=SEG PKA CAGR End Period
THENParts Kits Qty
END)
/
SUM(CASE WHENParts Kits Fiscal Year
=SEG PKA CAGR Start Period
THENParts Kits Qty
END))
,1/(SEG PKA CAGR End Period
-SEG PKA CAGR Start Period
+1))-1On the dashboard, you can set the CAGR calculation period (I know, I also hate the decimal in the year).
This automatically calculates the CAGR for the 2019–2023 period in the following graph:
If you found this post helpful, please use 💡/💖/👍/😊 below! If it solved your problem, don't forget to accept the answer.
1 -
Thanks! I was able to replicate this and it works great. It would be nice if Variables were more dynamic (i.e point the variable to an existing field and it populates the values. My data already has the Fiscal Year field in it, so having to manually add each year to the Variable selection list is tedious.
1
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
- 666 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