Forum Discussion
Bian
4 years agoHelper II
Semi-additive max date
Hi, I have used Alberto and Marcos DAX pattern for Semi-additive calculations Semi-additive calculations – DAX Patterns Primaraly the DAX code to calculate Balance per customer. I need to add ...
- 4 years ago
So something like this?
Customers Lost = VAR EndDate = DATE ( 10, 30, 2021 ) // Or from filter context VAR MaxChangeDates = ADDCOLUMNS ( SUMMARIZE ( Subscription, Customers[Name] ), "@MaxChangeDate", CALCULATE ( MAX ( Subscription[ChangeDate] ) ) ) VAR AddEndDateCol = ADDCOLUMNS ( MaxChangeDates, "@MaxEndDate", CALCULATE ( MAX ( Subscription[EndDate] ), TREATAS ( { @MaxChangeDate }, 'Date'[Date] ) ) ) RETURN COUNTROWS ( FILTER ( AddEndDateCol, [@MaxEndDate] = EndDate ) )( ^^ Not tested but hopefully gives an idea for the logic, at least.)
AlexisOlson
4 years agoSuper User
Bian wrote:
I get correct Count but not correct month.
What does this mean? I didn't write a measure to return a month.
Bian
4 years agoHelper II
True, I will mark this as complete and be forever greatful 🙂
Anyway you solved my main issue. Many thanks.