Rolling 12 Months Calculation
Trying to get the below into DOMO (below is done in PBI)
Monthly - 01/12/2024 - 31/12/2024 (1 Month) - Works for each month using the calculation - COUNT(DISTINCT Incident Number
)
Rolling - 01/01/2024 - 31/12/2024 (12 Months) - Need help
FYTD - 01/04/2024 - 31/12/2024 (Apr 2024 - Dec 2024) - Need help
Comments
-
You can use the following for SSI Rolling:
(
SUM(SSI Monthly
) +
LAG(SUM(SSI Monthly
), 11) OVER (ORDER BYYear-Month
) +
LAG(SUM(SSI Monthly
), 10) OVER (ORDER BYYear-Month
) +
LAG(SUM(SSI Monthly
), 9) OVER (ORDER BYYear-Month
) +
LAG(SUM(SSI Monthly
), 8) OVER (ORDER BYYear-Month
) +
LAG(SUM(SSI Monthly
), 7) OVER (ORDER BYYear-Month
) +
LAG(SUM(SSI Monthly
), 6) OVER (ORDER BYYear-Month
) +
LAG(SUM(SSI Monthly
), 5) OVER (ORDER BYYear-Month
) +
LAG(SUM(SSI Monthly
), 4) OVER (ORDER BYYear-Month
) +
LAG(SUM(SSI Monthly
), 3) OVER (ORDER BYYear-Month
) +
LAG(SUM(SSI Monthly
), 2) OVER (ORDER BYYear-Month
) +
LAG(SUM(SSI Monthly
), 1) OVER (ORDER BYYear-Month
))FYTD:
(
SUM(CASE WHENYear-Month
>= '2024-04-01' THENSSI Monthly
END) +
LAG(SUM(CASE WHENYear-Month
>= '2024-04-01' THENSSI Monthly
END), 11) OVER (ORDER BYYear-Month
) +
LAG(SUM(CASE WHENYear-Month
>= '2024-04-01' THENSSI Monthly
END), 10) OVER (ORDER BYYear-Month
) +
LAG(SUM(CASE WHENYear-Month
>= '2024-04-01' THENSSI Monthly
END), 9) OVER (ORDER BYYear-Month
) +
LAG(SUM(CASE WHENYear-Month
>= '2024-04-01' THENSSI Monthly
END), 8) OVER (ORDER BYYear-Month
) +
LAG(SUM(CASE WHENYear-Month
>= '2024-04-01' THENSSI Monthly
END), 7) OVER (ORDER BYYear-Month
) +
LAG(SUM(CASE WHENYear-Month
>= '2024-04-01' THENSSI Monthly
END), 6) OVER (ORDER BYYear-Month
) +
LAG(SUM(CASE WHENYear-Month
>= '2024-04-01' THENSSI Monthly
END), 5) OVER (ORDER BYYear-Month
) +
LAG(SUM(CASE WHENYear-Month
>= '2024-04-01' THENSSI Monthly
END), 4) OVER (ORDER BYYear-Month
) +
LAG(SUM(CASE WHENYear-Month
>= '2024-04-01' THENSSI Monthly
END), 3) OVER (ORDER BYYear-Month
) +
LAG(SUM(CASE WHENYear-Month
>= '2024-04-01' THENSSI Monthly
END), 2) OVER (ORDER BYYear-Month
) +
LAG(SUM(CASE WHENYear-Month
>= '2024-04-01' THENSSI Monthly
END), 1) OVER (ORDER BYYear-Month
))Results (I don't have the rest of your data to go farther back, but the numbers are matching with what I do have:
If I solved your problem, please select "yes" above
0 -
@ColemenWilson can this be done in beast mode or is your example done via magic ETL ?
Additionally, would this methodology work if you had a transaction table with day date granularity or does your methodology require you to create a summary table truncating the day > month ?
0 -
This is using a beastmode. I built it assuming month level granularity.
If I solved your problem, please select "yes" above
0 -
@ColemenWilson LAG() doesn't appear when I search functions in beast mode. Any thoughts ?
0 -
It will still work, it just doesn't show up in the functions list - along with many other mysql functions.
If I solved your problem, please select "yes" above
1 -
@ColemenWilson - the below beast mode calculation is not giving me an error but when I insert into the table, I get an error "An issue has occurred during processing. We are unable to complete the request at this time - 'undefined' "
(
SUM(SSI Monthly
) +
LAG(SUM(SSI Monthly
), 11) OVER (ORDER BYIncident Date (Year-Month)
) +
LAG(SUM(SSI Monthly
), 10) OVER (ORDER BYIncident Date (Year-Month)
) +
LAG(SUM(SSI Monthly
), 9) OVER (ORDER BYIncident Date (Year-Month)
) +
LAG(SUM(SSI Monthly
), 8) OVER (ORDER BYIncident Date (Year-Month)
) +
LAG(SUM(SSI Monthly
), 7) OVER (ORDER BYIncident Date (Year-Month)
) +
LAG(SUM(SSI Monthly
), 6) OVER (ORDER BYIncident Date (Year-Month)
) +
LAG(SUM(SSI Monthly
), 5) OVER (ORDER BYIncident Date (Year-Month)
) +
LAG(SUM(SSI Monthly
), 4) OVER (ORDER BYIncident Date (Year-Month)
) +
LAG(SUM(SSI Monthly
), 3) OVER (ORDER BYIncident Date (Year-Month)
) +
LAG(SUM(SSI Monthly
), 2) OVER (ORDER BYIncident Date (Year-Month)
) +
LAG(SUM(SSI Monthly
), 1) OVER (ORDER BYIncident Date (Year-Month)
)
)0 -
I think it is because you have both Incident Date and Year-Month in your ORDER BY. Also, do the fields in the beast mode match fields in your data? SSI Monthly, Incident Date, and Year-Month?
If I solved your problem, please select "yes" above
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 302 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 104 SQL DataFlows
- 633 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 760 Beast Mode
- 62 App Studio
- 42 Variables
- 699 Automate
- 181 Apps
- 457 APIs & Domo Developer
- 51 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 401 Distribute
- 116 Domo Everywhere
- 277 Scheduled Reports
- 8 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 111 Community Announcements
- 4.8K Archive