Forum Discussion
Count of Status Change
Dear All,
I need help on writing DAX for calculating the count of customers whose status flag is changing as shown in below table in a particular month.
1. Total number of distinct Customers for every month with max date.
2. Total number of distinct Customers Pending for every month..
| CustomerNumber | CustomerStatus | Date |
| 1 | Approved | 8/18/2017 |
| 1 | Pending | 8/22/2016 |
| 2 | Withdrawn | 8/18/2017 |
| 2 | Pending | 8/22/2016 |
| 3 | Unlicensed | 6/5/2018 |
| 4 | Regular | 10/25/2016 |
| 5 | Regular | 4/11/2016 |
| 6 | Approved | 8/26/2016 |
| 6 | Pending | 4/21/2016 |
| 7 | Approved | 6/12/2018 |
| 7 | Unlicensed | 11/15/2016 |
| 8 | Approved | 7/28/2016 |
| 8 | Pending | 11/16/2017 |
| 9 | Pending | 11/25/2015 |
| 10 | Approved | 10/2/2015 |
| 11 | Approved | 5/24/2017 |
| 11 | Closed | 8/18/2017 |
| 11 | Pending | 6/26/2017 |
| 12 | Approved | 10/25/2016 |
| 13 | Unlicensed | 9/30/2016 |
| 14 | Approved | 10/11/2016 |
| 15 | Approved | 2/16/2017 |
| 15 | Closed | 6/5/2018 |
| 15 | Pending | 10/11/2016 |
Hi shankyy7227,
1. Total number of distinct Customers for every month with max date.
Could you please provide more description? What is your desired result?
2. Total number of distinct Customers Pending for every month..
You could try this measure:
Measure 2 = CALCULATE ( DISTINCTCOUNT ( 'Example Data'[CustomerNumber] ), FILTER ( ALLEXCEPT ( 'Example Data', 'Example Data'[Date].[Month] ), 'Example Data'[CustomerStatus] = "Pending" ) )Best regards,
Yuliana Gu
1 Reply
- v-yulgu-msft
Microsoft Employee
Hi shankyy7227,
1. Total number of distinct Customers for every month with max date.
Could you please provide more description? What is your desired result?
2. Total number of distinct Customers Pending for every month..
You could try this measure:
Measure 2 = CALCULATE ( DISTINCTCOUNT ( 'Example Data'[CustomerNumber] ), FILTER ( ALLEXCEPT ( 'Example Data', 'Example Data'[Date].[Month] ), 'Example Data'[CustomerStatus] = "Pending" ) )Best regards,
Yuliana Gu