Forum Discussion
VinLee1314
3 years agoNew Member
Cumulative monthly count
Hi all,
Couldn't get my "Cumulative Mthly Leavers" column to work. Would appreciate your guidance, please.
Leavers =
CALCULATE(
[Count of Employees],
USERELATIONSHIP('Calendar'[Date], 'HR Dataset'[Term date])
) + 0
Cumulative Mthly Leavers =
CALCULATE
(
[Leavers],
FILTER
(
ALLSELECTED ( 'Calendar'[Month] ),
'Calendar'[Month] <= MAX ( 'Calendar'[Month] )
)
)
Thanks!
Vin
Hi VinLee1314
you have to YearMonth number column in your date table. The try the following
Cumulative Mthly Leavers =
CALCULATE (
[Leavers],
'Calendar'[YearMonth] <= MAX ( 'Calendar'[YearMonth] ),
ALLSELECTED ( 'Calendar' )
)
4 Replies
- daXtremeSolution Sage
// # Leavers TD = count of leavers to date [# Leavers TD] = var LastVisibleDate = MAX( 'Calendar'[Date] ) var Output = CALCULATE( [# Leavers], 'Calendar'[Date] <= LastVisibleDate, ALLSELECTED ( 'Calendar' ) ) return Output - VinLee1314New Member
I managed to get it working on a monthly basis. I would like the running total to continue after the year ends. How do I make changes to the DAX?
Cumulative Leavers =CALCULATE([Leavers],FILTER(CALCULATETABLE(SUMMARIZE('Calendar', 'Calendar'[Date].[MonthNo], 'Calendar'[Date].[Month]),ALLSELECTED('Calendar')),ISONORAFTER('Calendar'[Date].[MonthNo], MAX('Calendar'[Date].[MonthNo]), DESC,'Calendar'[Date].[Month], MAX('Calendar'[Date].[Month]), DESC)))Thanks!- tamerj1Community Champion
Hi VinLee1314
you have to YearMonth number column in your date table. The try the following
Cumulative Mthly Leavers =
CALCULATE (
[Leavers],
'Calendar'[YearMonth] <= MAX ( 'Calendar'[YearMonth] ),
ALLSELECTED ( 'Calendar' )
)- VinLee1314New Member