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 table that i need to count distinct values from. See simplified table example below (latest hour for day is a calculated column)
UserID | Date | Hour | Latest Hour for day |
John Smith | 10/01/2020 | 10 | 10 |
John Smith | 10/01/2020 | 10 | 10 |
John Smith | 11/01/2020 | 9 | 9 |
Sam Benson | 10/01/2020 | 10 | 10 |
Sam Benson | 11/01/2020 | 10 | 12 |
Sam Benson | 11/01/2020 | 12 | 12 |
I need to have multiple measures (for each hour of the working day - roughly 12 hours). For example i need the measure for hour 10 to tell me how many times a users latest hour for the day = 10. But this can only count the the same user once per day and it needs to count every single day in the range. In the table example above for hour 10 it should return 2 because on 10/01/2020 both John Smith and Sam Bensons latest hour was 10. Sometimes one user will may multiple rows for the same date and hour which complicates things.
Hope this makes sense,
Thanks
Solved! Go to Solution.
did not get completely is with example
but
calculate(distinctcount(UserID),filter(table, [hour]= [latest hour of day] && [hour] =10))
The date and hour can filter from slicer. Also you can have flag created as column where hour = lastest hour. Using ealier you can flag each date.
Can provide more details and explain with an example. If possible please share a sample pbix file after removing sensitive information.
Thanks.
My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
did not get completely is with example
but
calculate(distinctcount(UserID),filter(table, [hour]= [latest hour of day] && [hour] =10))
The date and hour can filter from slicer. Also you can have flag created as column where hour = lastest hour. Using ealier you can flag each date.
Can provide more details and explain with an example. If possible please share a sample pbix file after removing sensitive information.
Thanks.
My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
Thanks for this. I think you're on the right lines. I think it counts all the rows i need but due to the distinct count it only counts each userID once when it needs to count it once per day.
Please provide output example.
Hi @Anonymous
What does this mean?
I think it counts all the rows i need but due to the distinct count it only counts each userID once when it needs to count it once per day
Could you show some examples?
Best Regards
Maggie
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 |
---|---|
102 | |
101 | |
78 | |
70 | |
63 |
User | Count |
---|---|
140 | |
106 | |
100 | |
83 | |
73 |