Forum Discussion
Distinct count active customer by month
- 8 years ago
So, there is a little trick.
I created 2 measures:
For Unique Account Code:
Active Customer:=CALCULATE([Measure];FILTER(Transactions;Transactions[Amount]>0))
For Unique Client ID:
Active Customer ID:=CALCULATE(COUNTROWS(VALUES(Customer[Client ID]));FILTER(Transactions;Transactions[Amount]>0))
I hope this is what you are looking for.
Best regards.
My apology and I really appreciate your patience and time for helping me on this.
The below is my sample table:
| Trx Date | Account Code | Amount |
| 1-Mar-18 | A7 | 119 |
| 2-Mar-18 | A9 | 175 |
| 3-Mar-18 | A3 | 120 |
| 4-Mar-18 | A9 | 107 |
| 5-Mar-18 | A2 | 105 |
| 5-Apr-18 | A4 | 146 |
| 6-Apr-18 | A9 | 169 |
| 7-Apr-18 | A4 | 109 |
| 8-Apr-18 | A6 | 173 |
| 9-Apr-18 | A6 | 179 |
| 20-May-18 | A2 | 153 |
| 20-May-18 | A3 | 195 |
| 20-May-18 | A2 | 131 |
| 21-May-18 | A5 | 175 |
| 22-May-18 | A6 | 146 |
| 23-May-18 | A3 | 185 |
| 23-May-18 | A2 | 191 |
| 23-May-18 | A4 | 179 |
| Account Code | Account Type | Client ID |
| A1 | Basic | B1 |
| A2 | Premium | B1 |
| A3 | Basic | B2 |
| A4 | Basic | B2 |
| A5 | Basic | B3 |
| A6 | Basic | B4 |
| A7 | Basic | B5 |
| A8 | Basic | B5 |
| A9 | Premium | B5 |
| A10 | Premium | B6 |
I had created the relationship using account code.
I can get the amount of transaction for each unique Client Code below:
| Sum of Amount | Column Labels | |||
| Mar | Apr | May | Grand Total | |
| Basic | 239 | 607 | 880 | 1726 |
| B2 | 120 | 255 | 559 | 934 |
| B3 | 175 | 175 | ||
| B4 | 352 | 146 | 498 | |
| B5 | 119 | 119 | ||
| Premium | 387 | 169 | 475 | 1031 |
| B1 | 105 | 475 | 580 | |
| B5 | 282 | 169 | 451 | |
| Grand Total | 626 | 776 | 1355 | 2757 |
I would like to achieve the below instead:
| Active Client | ||||
| Mar | Apr | May | Grand Total | |
| Row Labels | ||||
| Basic | 2 | 2 | 3 | 4 |
| Premium | 2 | 1 | 1 | 2 |
So, there is a little trick.
I created 2 measures:
For Unique Account Code:
Active Customer:=CALCULATE([Measure];FILTER(Transactions;Transactions[Amount]>0))
For Unique Client ID:
Active Customer ID:=CALCULATE(COUNTROWS(VALUES(Customer[Client ID]));FILTER(Transactions;Transactions[Amount]>0))
I hope this is what you are looking for.
Best regards.
- Anonymous8 years agoNot applicable
Floriankx, thank you very much. Now the FILTER function better and also learn new function like Countrows. I will look into it further when have time.
Reallly appreciate your time and patience for teaching me.