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
Anonymous
Not applicable

Comparing semi-additive calculations as a % change

I followed the excellent Semi Additive mesure guide at sqlbi.com (https://www.sqlbi.com/articles/semi-additive-measures-in-dax/) and now have a report that tracks balences accurately and the measure reports the most recent balance of the quarter. 

 

 

 

LastBalance Ever :=
VAR MaxDate =
MAX ( 'Date'[Date] )
VAR LastDates =
ADDCOLUMNS (
CALCULATETABLE (
VALUES ( Balances[Name] ),
ALL ( 'Date' )
),
"LastDay", CALCULATE (
MAX ( 'Balances'[Date] ),
ALL ( 'Date' ),
'Date'[Date] <= MaxDate
)
)
VAR LastDatesWithLineage =
TREATAS (
LastDates,
Balances[Name],
'Date'[Date]
)
VAR Result =
CALCULATE (
SUM ( Balances[Balance] ),
LastDatesWithLineage
)
RETURN
Result

 

I'm now keen to understand how I would compare changes between the most recent balence and the previous most recent balence. For example;

 

SupplierContract SpendEffective DateChange
A            10,000.0001/01/20190%
A            15,000.0001/01/2020150%
A            10,000.0002/01/202167%

 

Is there a DAX command that would allow me to compare with the previous last balence? Any ideas on how I could approach this?

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@Anonymous Please refer to my measure for this sample data:

 

Measure = MAX('Table'[Contract Spend]) / CALCULATE(MAX([Contract Spend]),FILTER(ALL('Table'),[Supplier]=MAX('Table'[Supplier]) && [Effective Date]<MAX([Effective Date])))

 


 
Updating Media


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
V-pazhen-msft
Community Support
Community Support

@Anonymous Please refer to my measure for this sample data:

 

Measure = MAX('Table'[Contract Spend]) / CALCULATE(MAX([Contract Spend]),FILTER(ALL('Table'),[Supplier]=MAX('Table'[Supplier]) && [Effective Date]<MAX([Effective Date])))

 


 
Updating Media


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

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.

Top Solution Authors
Top Kudoed Authors