The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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