Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mterry
Helper V
Helper V

Unwinding annual cumulative data

I have data sets the I receive quarterly and the information is cumulative, so I'm looking for the most succint way to convert it from cumulative to quarterly data in the form of a new column that subtracts the previous period by country and by category. 

 

The first table below is how the data appear now, the second is what I would like to add. I think I could unpivot and just subtract, but hoping there is a better way to perform this in the existing format. 

 

CountrySupplyDate Annual Cumulative Amount 
United StatesComputers3/31/2020                                          5,000.00
CanadaComputers3/31/2020                                          5,000.00
UKComputers3/31/2020                                          5,000.00
United StatesChairs3/31/2020                                          6,000.00
CanadaChairs3/31/2020                                          6,000.00
UKChairs3/31/2020                                          6,000.00
United StatesDesk3/31/2020                                          7,000.00
CanadaDesk3/31/2020                                          7,000.00
UKDesk3/31/2020                                          7,000.00
United StatesMonitor3/31/2020                                          8,000.00
CanadaMonitor3/31/2020                                          8,000.00
UKMonitor3/31/2020                                          8,000.00
United StatesOther3/31/2020                                          9,000.00
CanadaOther3/31/2020                                       10,000.00
UKOther3/31/2020                                       10,000.00
United StatesComputers6/30/2020                                       10,000.00
CanadaComputers6/30/2020                                       12,000.00
UKComputers6/30/2020                                       12,000.00
United StatesChairs6/30/2020                                       12,000.00
CanadaChairs6/30/2020                                       14,000.00
UKChairs6/30/2020                                       14,000.00
United StatesDesk6/30/2020                                       14,000.00
CanadaDesk6/30/2020                                       16,000.00
UKDesk6/30/2020                                       16,000.00
United StatesMonitor6/30/2020                                       16,000.00
CanadaMonitor6/30/2020                                       18,000.00
UKMonitor6/30/2020                                       20,000.00
United StatesOther6/30/2020                                       20,000.00
CanadaOther6/30/2020                                       20,000.00
UKOther6/30/2020                                       24,000.00
United StatesComputers9/30/2020                                       24,000.00
CanadaComputers9/30/2020                                       24,000.00
UKComputers9/30/2020                                       28,000.00
United StatesChairs9/30/2020                                       28,000.00
CanadaChairs9/30/2020                                       28,000.00
UKChairs9/30/2020                                       32,000.00
United StatesDesk9/30/2020                                       32,000.00
CanadaDesk9/30/2020                                       32,000.00
UKDesk9/30/2020                                       36,000.00
United StatesMonitor9/30/2020                                       40,000.00
CanadaMonitor9/30/2020                                       40,000.00
UKMonitor9/30/2020                                       40,000.00
United StatesOther9/30/2020                                       48,000.00
CanadaOther9/30/2020                                       48,000.00
UKOther9/30/2020                                       48,000.00

 

What I would like:

CountrySupplyDate Cumulative Amount  Amount Per Period 
United StatesComputers3/31/2020                             5,000.00                       5,000.00
CanadaComputers3/31/2020                             5,000.00                       5,000.00
UKComputers3/31/2020                             5,000.00                       5,000.00
United StatesChairs3/31/2020                             6,000.00                       6,000.00
CanadaChairs3/31/2020                             6,000.00                       6,000.00
UKChairs3/31/2020                             6,000.00                       6,000.00
United StatesDesk3/31/2020                             7,000.00                       7,000.00
CanadaDesk3/31/2020                             7,000.00                       7,000.00
UKDesk3/31/2020                             7,000.00                       7,000.00
United StatesMonitor3/31/2020                             8,000.00                       8,000.00
CanadaMonitor3/31/2020                             8,000.00                       8,000.00
UKMonitor3/31/2020                             8,000.00                       8,000.00
United StatesOther3/31/2020                             9,000.00                       9,000.00
CanadaOther3/31/2020                             9,000.00                       9,000.00
UKOther3/31/2020                             9,000.00                       9,000.00
United StatesComputers6/30/2020                           10,000.00                       5,000.00
CanadaComputers6/30/2020                           12,000.00                       7,000.00
UKComputers6/30/2020                           12,000.00                       7,000.00
United StatesChairs6/30/2020                           12,000.00                       6,000.00
CanadaChairs6/30/2020                           14,000.00                       8,000.00
UKChairs6/30/2020                           14,000.00                       8,000.00
United StatesDesk6/30/2020                           14,000.00                       7,000.00
CanadaDesk6/30/2020                           16,000.00                       9,000.00
UKDesk6/30/2020                           16,000.00                       9,000.00
United StatesMonitor6/30/2020                           16,000.00                       8,000.00
CanadaMonitor6/30/2020                           18,000.00                    10,000.00
UKMonitor6/30/2020                           18,000.00                    10,000.00
United StatesOther6/30/2020                           18,000.00                       9,000.00
CanadaOther6/30/2020                           20,000.00                    11,000.00
UKOther6/30/2020                           24,000.00                    15,000.00
United StatesComputers9/30/2020                           20,000.00                    10,000.00
CanadaComputers9/30/2020                           20,000.00                       8,000.00
UKComputers9/30/2020                           20,000.00                       8,000.00
United StatesChairs9/30/2020                           24,000.00                    12,000.00
CanadaChairs9/30/2020                           24,000.00                    10,000.00
UKChairs9/30/2020                           24,000.00                    10,000.00
United StatesDesk9/30/2020                           28,000.00                    14,000.00
CanadaDesk9/30/2020                           28,000.00                    12,000.00
UKDesk9/30/2020                           28,000.00                    12,000.00
United StatesMonitor9/30/2020                           32,000.00                    16,000.00
CanadaMonitor9/30/2020                           32,000.00                    14,000.00
UKMonitor9/30/2020                           32,000.00                    14,000.00
United StatesOther9/30/2020                           36,000.00                    18,000.00
CanadaOther9/30/2020                           36,000.00                    16,000.00
UKOther9/30/2020                           36,000.00                    12,000.00

 

3 REPLIES 3
mterry
Helper V
Helper V

I've ran into a bug with the above that seems to be a common occurrence in BI, but I can't work out. The formual works properly for displaying a total amount broken out by each quarter. However, if I include all the quarters for a year in a matrix, then the total showing in the matrix is way off even though the subtotals by quarter are accurate. If I display the same data in a waterfall visual, all data is accurate, including the total. Unfortunately I'm unable to share the data, and I realize that makes my question difficult, but does anyone have suggestions I could use so that totals are wrong when I use the above measure? Is there a way to replicate this in Power Query or with a calculated column? 

amitchandak
Super User
Super User

@mterry , refer if this can help

 

Distributing/Allocating the Yearly Target(Convert to Daily Target): Measure ( Daily/YTD): Magic of CLOSINGBALANCEYEAR With TOTALYTD/DATESYTD: https://community.powerbi.com/t5/Community-Blog/Power-BI-Distributing-Allocating-the-Yearly-Target-C...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

I read through that article and I don't think it quite gets me what I want. I think I got there with the below, every quarter subtracts the cumulative amount from the previous quarter unless it's Q1, effectively limiting the calcs to be within the same year. 

 

Quarterly Spend = IF(QUARTER(MAX(SAP_quarterly[Date])) = 1, SUM(SAP_quarterly[**bleep**. Ann. Spend]), SUM(SAP_quarterly[**bleep**. Ann. Spend])-CALCULATE(SUM(SAP_quarterly[**bleep**. Ann. Spend]), PREVIOUSQUARTER(SAP_quarterly[Date])))

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.