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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MrSujay
Resolver II
Resolver II

Running total for measure without date colum

 

I want to run the cumulative running sum/total in table visual.
Here Fiscal month is a column and Monthly Comm Earned is a measure which includes another measure also.
now I want to calculate the sum of the running total in the sales running column.

like march will have only march amount and in April contains march + April amount and so on..

 

MrSujay_0-1630523187308.png

 

 

Monthly Comm Earned = 
IF(
    ISFILTERED(Transactions[Fiscal Month]),
    [MonthlyCommEarnedCalc],
    SUMX(
        VALUES(Transactions[Fiscal Month]), [MonthlyCommEarnedCalc]
    )
)

 

 

I Tried the below query but not working.

 

Sales Running = 
Var MaxMonth = Max(Transactions[Fiscal Month Nbr])
Var Result =  CALCULATE(
                 Transactions[Monthly Comm Earned] ,
                 Transactions[Fiscal Month nbr]<= MaxMonth,
                 All(Transactions[Fiscal Month Nbr])
)
Return Result

 

 
April month should return value 8560.98 in sales running column/measure.

1 ACCEPTED SOLUTION
MrSujay
Resolver II
Resolver II

Finally, I got the solution to calculate the running total for measures without a date column.

To calculate the running total for another measure then just add that measure code ( if block ) into your running total code.

example code :

 

Monthly Comm running sum = 
VAR month = MAX(Transactions[Fiscal Month Nbr])
VAR result =  CALCULATE(  
			 IF( ISFILTERED(Transactions[Fiscal Month]),
			      [MonthlyCommEarnedCalc],
			      SUMX(VALUES(Transactions[Fiscal Month]), [MonthlyCommEarnedCalc]) 
                             ),
                              Transactions[Fiscal Month] <= month,
                              ALLSELECTED(Transactions)
                             ) 
Return result

 

 

View solution in original post

2 REPLIES 2
MrSujay
Resolver II
Resolver II

Finally, I got the solution to calculate the running total for measures without a date column.

To calculate the running total for another measure then just add that measure code ( if block ) into your running total code.

example code :

 

Monthly Comm running sum = 
VAR month = MAX(Transactions[Fiscal Month Nbr])
VAR result =  CALCULATE(  
			 IF( ISFILTERED(Transactions[Fiscal Month]),
			      [MonthlyCommEarnedCalc],
			      SUMX(VALUES(Transactions[Fiscal Month]), [MonthlyCommEarnedCalc]) 
                             ),
                              Transactions[Fiscal Month] <= month,
                              ALLSELECTED(Transactions)
                             ) 
Return result

 

 

Greg_Deckler
Super User
Super User

@MrSujay You will need something that defines "before", like a fiscal year/month column 202101, 202102, etc. Then you can do something like:

Measure =
  VAR __Current = MAX('Transactions[Fiscal Month nbr])
  VAR __Table = FILTER(ALL('Table'),[Fiscal Month nbr] <= __Current)
RETURN
  SUMX(__Table,[Monthly Comm Earned])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.