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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.