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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
bombom
Helper I
Helper I

Power BI calculate DAX measure cumulatively

Hi! I can't configure how to calculate DAX measure cumulatively. The DAX measure by it self looks like this:

 

UpdateTicket_ = CALCULATE(Logging[LogDistcount_], Logging[Step] = 7) # DAX measure to filter distinct ID by some condition.

 

LogDistcount_ = DISTINCTCOUNT(Logging[TicketId]) # DAX measure to calculate distinct ID presented in the featured dataset.

 

The ploblem is that formula construction to calculate cumulatively doesn't allow to sum DAX measure. I mean this: =CALCULATE(SUM(UpdateTicket_)... The formula doesn't give an option to select UpdateTicket_ to make a SUM of it. This measure doesn't appear in the selection list of the SUM formula at all.

 

Currently output of the UpdateTicket_ measure looks like this:

StartTime_DateOnlyUpdateTicket_
08.11.2022950
09.11.20221056
10.11.20221056
11.11.20221056
12.11.20221056
13.11.20221056

 

What I am looking for:

 

StartTime_DateOnlyUpdateTicket_UpdateTicket_Cumulatively
08.11.2022950950
09.11.202210562006
10.11.202210563062
11.11.202210564118
12.11.202210565174
13.11.202210566230
1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi, @bombom 

According to your description, you want to calculate the cumulatively value of a measure . Right?

Here are the steps you can refer to :

(1)This is my test data:

vyueyunzhmsft_0-1670293999636.png

 

I create a measure like this:

UpdateTicket_ = SUM('Table'[UpdateTicket])

(2)Then we can click "New Measure" to create a measure like this:

Mul Value = var _t =SUMMARIZE( ALLSELECTED('Table') ,'Table'[StartTime_DateOnly] , "UpdateTicket" , [UpdateTicket_])
var _curdate = MAX('Table'[StartTime_DateOnly])
var _mul_table  =  FILTER( _t , [StartTime_DateOnly] <= _curdate)
return
SUMX(_mul_table , [UpdateTicket_])

(3)Then we can put this on the visual and we can meet your need , the result is as follows:

vyueyunzhmsft_1-1670294232461.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
v-yueyunzh-msft
Community Support
Community Support

Hi, @bombom 

According to your description, you want to calculate the cumulatively value of a measure . Right?

Here are the steps you can refer to :

(1)This is my test data:

vyueyunzhmsft_0-1670293999636.png

 

I create a measure like this:

UpdateTicket_ = SUM('Table'[UpdateTicket])

(2)Then we can click "New Measure" to create a measure like this:

Mul Value = var _t =SUMMARIZE( ALLSELECTED('Table') ,'Table'[StartTime_DateOnly] , "UpdateTicket" , [UpdateTicket_])
var _curdate = MAX('Table'[StartTime_DateOnly])
var _mul_table  =  FILTER( _t , [StartTime_DateOnly] <= _curdate)
return
SUMX(_mul_table , [UpdateTicket_])

(3)Then we can put this on the visual and we can meet your need , the result is as follows:

vyueyunzhmsft_1-1670294232461.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

FreemanZ
Super User
Super User

try this

UpdateTicket_Cumulatively =
CALCULATE(
    [UpdateTicket_],
    Logging[StartTime_DateOnly] <=MAX(Logging[StartTime_DateOnly])
)

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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