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
prakash11440278
Post Prodigy
Post Prodigy

Grand Total substract with previous record count

Hi Team,

Please share the dax expression for the below requirement.

 

prakash11440278_0-1618466487273.png

 

1 ACCEPTED SOLUTION
sayaliredij
Super User
Super User

Thank you for the data.

 

You can create a measure using the following formula.

It will be best if you create a calculated column by summing up all the columns in every row. to get total roll up amount

 

Total =
VAR totalvalue =
CALCULATE ( SUM ( 'Table'[RollUp] ), REMOVEFILTERS ( 'Table' ) )
VAR monthvalue =
CALCULATE ( SUM ( 'Table'[RollUp] ) )
VAR Total =
IF ( ISBLANK ( monthvalue ), BLANK (), totalvalue )
VAR CurrentDate =
MAX ( 'Table'[Month] )
VAR rollupYTD =
CALCULATE (
SUM ( 'Table'[RollUp] ),
FILTER ( ALL ( 'Table' ), 'Table'[Month] < CurrentDate )
)
VAR result = Total - rollupYTD
RETURN
result

 You can get result as follows

sayaliredij_0-1618486091702.png

 Thanks,

Sayali 

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





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

Proud to be a Super User!




View solution in original post

4 REPLIES 4
sayaliredij
Super User
Super User

Thank you for the data.

 

You can create a measure using the following formula.

It will be best if you create a calculated column by summing up all the columns in every row. to get total roll up amount

 

Total =
VAR totalvalue =
CALCULATE ( SUM ( 'Table'[RollUp] ), REMOVEFILTERS ( 'Table' ) )
VAR monthvalue =
CALCULATE ( SUM ( 'Table'[RollUp] ) )
VAR Total =
IF ( ISBLANK ( monthvalue ), BLANK (), totalvalue )
VAR CurrentDate =
MAX ( 'Table'[Month] )
VAR rollupYTD =
CALCULATE (
SUM ( 'Table'[RollUp] ),
FILTER ( ALL ( 'Table' ), 'Table'[Month] < CurrentDate )
)
VAR result = Total - rollupYTD
RETURN
result

 You can get result as follows

sayaliredij_0-1618486091702.png

 Thanks,

Sayali 

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





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

Proud to be a Super User!




sayaliredij
Super User
Super User

Could you provide how the data looks like?  In this example, it is not possible to know how we get the first value.

 

Regards,

Sayali





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

Proud to be a Super User!




Hi @sayaliredij , Thanks for your reply. PFB screen shot.

prakash11440278_0-1618467753773.png

 

Hi, @prakash11440278 

Does @sayaliredij ’s solution  can work  for you?

If it is,  please mark the helpful replies or add your reply as Answered to close this thread.
It will help other community members easily find the solution when they get the similar issue.

Best Regards,
Community Support Team _ Eason

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.