Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello Guys,
THis is how my data look like,
I need to count the number of "In" for a particular person for a relative number of days.
A person can be in and out for multiple number of times. Ideally, I'm looking to count a In for a particular User_Id, since there could be multiple people with same names.
Looking forward to hearing from you all.
Thanks,
Anand
Solved! Go to Solution.
Hi @Anonymous ,
At first, you need to add an index column in the query editor.
Then add an new column "rank".
RANK= RANKX ( FILTER ( 'Table', 'Table'[ID] = EARLIER ( 'Table'[ID] ) ), 'Table'[Index], , ASC, DENSE )
Now, you could use COUNTROWS() function.
Measure = COUNTROWS(FILTER('Table','Table'[SCAN_TYPE]="IN"&&'Table'[RANK] = 1))
Hi @Anonymous ,
At first, you need to add an index column in the query editor.
Then add an new column "rank".
RANK= RANKX ( FILTER ( 'Table', 'Table'[ID] = EARLIER ( 'Table'[ID] ) ), 'Table'[Index], , ASC, DENSE )
Now, you could use COUNTROWS() function.
Measure = COUNTROWS(FILTER('Table','Table'[SCAN_TYPE]="IN"&&'Table'[RANK] = 1))
Thanks for your reply.
Yeah I figured that out yesterday. I used count rowsas well but with a different approach.
I will mark this as a solution.
Thanks again!
Hi Anand,
As per my analysis,You can create a unique field by combining user_id and Scan type afterwords you can calculate with the number of in count per user.
Hope this willl help you out.
Regards,
Pratima
Thank you for your reply.
But I will need to use a slicer with dates. So creating a unique field would not work with filter.
I would just need a measure to count the first In for unique user_id with date filters.
Thanks,
Anand
User | Count |
---|---|
84 | |
79 | |
71 | |
48 | |
43 |
User | Count |
---|---|
111 | |
54 | |
50 | |
40 | |
40 |