Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a database that I need to be able to count only the first time a row of data appears. Below is part of the database:
Date | Customer ID | Apt set | Confirmed | issued | sat | Result | Sale Amount |
2/27/2017 5:18:48 PM | 397500 | 1 | 1 | 0 | 0 | ROC | |
2/28/2017 9:03:05 PM | 397500 | 1 | 1 | 1 | 0 | 1Leg | |
2/27/2017 6:04:14 PM | 397501 | 1 | 1 | 0 | 0 | CTC | |
2/27/2017 5:48:22 PM | 397502 | 1 | 1 | 1 | 1 | 3 | |
3/6/2017 7:05:05 PM | 397502 | 1 | 1 | 0 | 0 | ROC | |
3/8/2017 2:39:46 PM | 397502 | 1 | 1 | 0 | 0 | Unissued | |
3/9/2017 10:08:13 AM | 397502 | 1 | 1 | 1 | 1 | 3 | |
2/27/2017 12:57:33 PM | 397503 | 1 | 0 | 0 | 0 | ROC | |
3/2/2017 4:09:14 PM | 397503 | 1 | 1 | 0 | 0 | CNC | |
2/27/2017 6:00:03 PM | 397504 | 1 | 1 | 1 | 0 | CTC | |
3/14/2017 5:14:40 PM | 397504 | 1 | 0 | 0 | 0 | Verif | |
2/27/2017 6:15:12 PM | 397505 | 1 | 1 | 0 | 0 | CTC | |
2/27/2017 6:01:54 PM | 397506 | 1 | 0 | 1 | 0 | 1Leg | |
2/27/2017 1:07:50 PM | 397507 | 1 | 0 | 1 | 1 | Sale | 21170.6 |
3/6/2017 3:57:19 PM | 397508 | 1 | 1 | 1 | 1 | Sale | 13387 |
3/7/2017 12:17:35 PM | 397509 | 1 | 1 | 1 | 0 | NC | |
3/8/2017 9:38:57 AM | 397509 | 1 | 1 | 1 | 1 | 3 | |
3/18/2017 12:12:22 PM | 397509 | 1 | 1 | 0 | 0 | CTC | |
2/27/2017 5:55:42 PM | 397510 | 1 | 0 | 0 | 0 | ROC | |
3/6/2017 2:24:53 PM | 397510 | 1 | 1 | 0 | 0 | COC | |
2/27/2017 2:21:20 PM | 397511 | 1 | 1 | 0 | 0 | ROC | |
3/6/2017 2:10:11 PM | 397511 | 1 | 1 | 1 | 1 | Sale | 12887 |
3/9/2017 4:11:31 PM | 397511 | 1 | 1 | 1 | 1 | 3 | |
2/27/2017 1:26:06 PM | 397512 | 1 | 1 | 1 | 0 | 1Leg | |
2/27/2017 1:27:45 PM | 397513 | 1 | 1 | 0 | 0 | ROC | |
3/1/2017 5:22:00 PM | 397513 | 1 | 1 | 1 | 0 | NH | |
2/27/2017 2:02:50 PM | 397514 | 1 | 1 | 0 | 0 | ROC | |
3/1/2017 1:42:26 PM | 397514 | 1 | 1 | 0 | 0 | COC | |
2/28/2017 8:01:00 AM | 397515 | 1 | 1 | 1 | 1 | 5 |
So, if I want to know how many customer's (customer ID) contacted us in a month I would not want to count everytime we talked to them, only the first time. I.E. customer ID 397500 we spoke to on 2/27 and again on 2/28. Since it is the same customer I would only want to count it one time, for the 27th. Any help, suggestions or ideas are greatly appreciated!
HW
Solved! Go to Solution.
If you don't want to use DAX - you can get the same result in the Query Editor using Group By
1) Duplicate your Table
2) then Group By - Customer ID and the new Column "First Contact" you are creating based on the MIN date for each Customer ID
3) Close & Apply
4) Create a Matrix - drag First Contact to the Rows and Customer ID to the Values
(change to Distinct -although the values are already distinct because we did the Group BY)
Follow the picture below...
OPTION 2
You can actually achieve the same result with a simple DAX Column in your current Table
First Contact Column = CALCULATE ( FIRSTNONBLANK('Table'[Date],1), ALLEXCEPT('Table', 'Table'[Customer ID]) )
Then Create a Matrix HOWEVER
1) use the First Contact Column in the Rows (keep only Year and Month from the Hierarchy)
2) drag First Contact Column again but this time to the Values
AND this time you have to change the default earliest to distinct count
Hope this helps!
Let me know if you have any questions!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |