Forum Discussion
Cumulative count with null values
- 8 years ago
Hi scooby91,
1. In your scenario, the Cumulative End should work. The issue is not related to the expression. It is because that the MonthYearNo is based on Start Date. If you create a new MonthYearNo based on End Date and put it with Cumulative End into another table. The result should be right. Please refer;
2. For this scenario, you can try to calculate the Cumulative count based on slicer (Table 2) MonthYearNo not based on your source table (cumulative) MonthYearNo.
To achieve this, first we should convert MonthYearNo to number type:
MonthYearNo = YEAR('Calendar'[Date])*100 + MONTH('Calendar'[Date] )Then try following measure:
New Cumulative Start = CALCULATE ( COUNTROWS ( FILTER ( ALL ( cumulative ), cumulative[MonthYearNo] <= MAX ( 'Table 2'[MonthYearNo] ) ) ) )Then it will display the cumulative count for each month even the month doesn't have corresponding value in source table.
Thanks,
Xi Jin.
Hi scooby91,
1. In your scenario, the Cumulative End should work. The issue is not related to the expression. It is because that the MonthYearNo is based on Start Date. If you create a new MonthYearNo based on End Date and put it with Cumulative End into another table. The result should be right. Please refer;
2. For this scenario, you can try to calculate the Cumulative count based on slicer (Table 2) MonthYearNo not based on your source table (cumulative) MonthYearNo.
To achieve this, first we should convert MonthYearNo to number type:
MonthYearNo = YEAR('Calendar'[Date])*100 + MONTH('Calendar'[Date] )Then try following measure:
New Cumulative Start =
CALCULATE (
COUNTROWS (
FILTER (
ALL ( cumulative ),
cumulative[MonthYearNo] <= MAX ( 'Table 2'[MonthYearNo] )
)
)
)Then it will display the cumulative count for each month even the month doesn't have corresponding value in source table.
Thanks,
Xi Jin.
- scooby918 years agoNew Member
Hi v-xjiin-msft, thanks for the solution! Much appreciated!