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
untrue
Regular Visitor

Another question on Rolling Sum

I have a table of quantities and respective dates. I want to create a Rolling Sum by quarters.

E.g. the table is the following:

Date            Qty

01-Jan-17     7

01-Oct-17     2

 

The formula I am using:

 

Running Total CANX Quantity =
CALCULATE (
SUM(Table[Qty]),
FILTER (
ALL( Table ),
Table[Date] <= max(Table[Date])
),
)

 

The problem is that in the Matrix Viz the Data is shown as:

 

2017

Qtr 1    Qtr 2    Qtr 3     Qtr 4

 7                                     9

 

And I need  Qtr 2 and Qtr 3 also display 7

 

Any suggestions?

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @untrue,

 

Do you have an individual Calendar table? If not, you need to create one first(using CALENDAR Function (DAX)).

 

Then you should be able to use the formula below to create the measure and show it within the Matrix with the date column from the created Calendar table.

Running Total CANX Quantity = 
CALCULATE (
    SUM ( Table1[Qty] ),
    FILTER ( ALL('Date'),'Date'[Date]<=MAX('Date'[Date])&&'Date'[Year]=MAX('Date'[Year]))
)

r1.PNG

 

Here is sample pbix file for your reference.Smiley Happy

 

Regards

View solution in original post

1 REPLY 1
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @untrue,

 

Do you have an individual Calendar table? If not, you need to create one first(using CALENDAR Function (DAX)).

 

Then you should be able to use the formula below to create the measure and show it within the Matrix with the date column from the created Calendar table.

Running Total CANX Quantity = 
CALCULATE (
    SUM ( Table1[Qty] ),
    FILTER ( ALL('Date'),'Date'[Date]<=MAX('Date'[Date])&&'Date'[Year]=MAX('Date'[Year]))
)

r1.PNG

 

Here is sample pbix file for your reference.Smiley Happy

 

Regards

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!

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.