Forum Discussion

Kate_24's avatar
Kate_24
Regular Visitor
3 years ago
Solved

Running total for a specific period

Dear all,    I am new user of Power Bi and I am not good at DAX.  I created a quick measure "Running total" in order to display the cumulative sales across months.  The available data are until J...
  • v-zhangti's avatar
    v-zhangti
    3 years ago

    Hi, Kate_24 

     

    You can try the following methods.

    Measure:

    Cumulative = 
    Var _Sum=CALCULATE(SUM('Table 1'[Sales]),FILTER(ALL('Table 2'),[Month_U]<=SELECTEDVALUE('Table 2'[Month_U])))
    Var _Maxmonth=CALCULATE(MAX('Table 1'[Month]),ALL('Table 1'))
    Return
    IF(SELECTEDVALUE('Table 2'[Month_U])>_Maxmonth,BLANK(),_Sum)

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

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