Forum Discussion
Displaying data by latest timestamp
Hi there,
I am building a report to visualize number of patients on each hospital unit. This data is inputted by nursing staff throughout same day. The idea is to create a table that shows last inputted number by unit. I can filter it by MAX date but not by last timestamp. Wondering if anyone can help me out? Thanks so much!!
Input:
Number of Patients | Unit |Created
10 A 6/6/2020 13:00
15 A 6/6/2020 15:00
13 A 6/6/2020 16:00
8 B 6/6/2020 09:00
7 B 6/6/2020 09:15
Output:
Number of Patients |Unit |Created
13 A 6/6/2020 16:00
7 B 6/6/2020 09:15
Hi Anonymous ,
You can create a visual level filter:
Measure = IF(MAX('Table'[Created]) = CALCULATE(MAX('Table'[Created]),ALLEXCEPT('Table','Table'[Unit])),1,0)If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
6 Replies
- parry2kSuper User
Anonymous add following measure to get the result:
Measure = CALCULATE ( SUM ( 'Table (2)'[Number of Patients] ), KEEPFILTERS ( TOPN ( 1, ALLSELECTED ( 'Table (2)'[Created] ), CALCULATE ( MAX ( 'Table (2)'[Created] ) ), DESC ) ) )Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- AnonymousNot applicable
Hi parry2k I tried the formula but it's giving a total sum of number of patients on 5C rather than the most recent entry.
- parry2kSuper User
Anonymous do you have two records for the same timestamp on 5c? Not sure if I understood your question. Maybe share sample data where you see this issue to further look into it.
- AnonymousNot applicable
Hi parry2k
I have attached the data - I am trying to display the latest census and latest projected census by unit
For 8C - I would like to display current census inputted 9 minutes ago
and 5C it would be the current census inputted yesterday at 5:02 PM
Beyond the table, would it be possible to use the measure as a report level filter? I appreciate your input! Thanks so much!
- parry2kSuper User
Anonymous this doesn't help. If you need help, you need to provide the data you are using in the report, these images are not going to help. Read this post to get your answer quickly.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490 - v-deddai1-msftCommunity Support
Hi Anonymous ,
You can create a visual level filter:
Measure = IF(MAX('Table'[Created]) = CALCULATE(MAX('Table'[Created]),ALLEXCEPT('Table','Table'[Unit])),1,0)If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai