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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
lingleji
Frequent Visitor

Cumulative totals not working in calculation group but working in a measure

Hi super users.  I've got a cumulative total calculation that works as a measure, but when I try to use it (even modified), it isn't returning the correct values.  

This measure is working.

Cumulative Revenue =

VAR MonthStart = DISTINCT (
SELECTCOLUMNS (
FILTER('Fiscal Calendar', 'Fiscal Calendar' [Calendar_Date] = Today()-1) ,
"Fiscal Calendar", [Month_Start_Date]
))

RETURN CALCULATE ([Total Revenue],
 FILTER(ALLSELECTED('Collected Payments'),
'Collected Payments'[Invoice Closed Date] <= MAX('Collected Payments'[Invoice Closed Date])
))

 

This is what I've tried using in the Calculation Group for Cumulative Revenue, but it just returns the total for the current day.

VAR MonthStart = DISTINCT ( SELECTCOLUMNS ( FILTER('Fiscal Calendar', 'Fiscal Calendar' [Calendar_Date] = Today()-1) , "Fiscal Calendar", [Month_Start_Date] )) RETURN CALCULATE (SUM('Collected Payments'[Amount]), --[Total Revenue], FILTER(ALLSELECTED('Collected Payments'), 'Collected Payments'[Invoice Closed Date] <= MAX('Collected Payments'[Invoice Closed Date]) 

 Cumulative Actuals - Working.PNG

 

Cumulative Actuals.PNG

Any help would be greatly appreciated.  Thanks in advance!

2 REPLIES 2
liuqi_pbi
Resolver II
Resolver II

Hi @lingleji 

 

The variable MonthStart is not used in your measure, what is it created for? 

 

For the cumulative total in calculation group, the solution in the following thread may be helpful. You could give it a try. 

Calculation groups for cumulative total DAX Pattern - Microsoft Power BI Community

 

----------------------------------------------------------------------

If this reply helps solve the problem, please mark it as Solution! Kudos are appreciated too!

DataInsights
Super User
Super User

@lingleji,

 

If you want the cumulative total to reset at the end of each year, you can use a year-to-date calculation:

 

Cumulative Revenue =
CALCULATE (
    SUM ( 'Collected Payments'[Amount] ),
    DATESYTD ( 'Fiscal Calendar'[Calendar_Date] )
)

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.