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.
Hello,
I am trying to make a report that shows whether certain people are currently inside or outside our factory. People read cards at turnstiles and these records are entered into a program's database
The relevant table I got with direct query is as follows.
Name | Surname | Door | Last Event Date |
Alex | X | Entrance Turnstile | 29.08.2023 11:48 |
Ally | X | Exit Turnstile | 29.08.2023 10:18 |
John | X | Exit Turnstile | 29.08.2023 07:00 |
Tanya | X | Exit Turnstile | 29.08.2023 16:00 |
Alex | X | Exit Turnstile | 29.08.2023 15:30 |
Ally | X | Entrance Turnstile | 29.08.2023 11:54 |
John | X | Entrance Turnstile | 29.08.2023 15:00 |
Each time a person swipes their card at the turnstile, a record is made in this table. I want to show the people who are inside with the "Entrance Turnstile" card according to the latest event date in the table. So when I look at the report, I want to see who is in there right now. I want the result of the table above to be as follows.
Name | Surname | Door | Last Event Date | Status |
John | X | Entrance Turnstile | 29.08.2023 15:00 | Inside |
Ally | X | Entrance Turnstile | 29.08.2023 11:54 | Inside |
According to the first table, John and Ally are inside, so I only want to see them in my table. How can I do that?
Thanks for help
Regards.
Solved! Go to Solution.
Hi @koray ,
Please try:
Status =
VAR __name =
MAX ( VAccessControlLog[Name] )
VAR __last_event_date =
CALCULATE (
MAX ( VAccessControlLog[EventDate] ),
FILTER (
ALLSELECTED ( 'VAccessControlLog' ),
'VAccessControlLog'[Name] = __name
)
)
VAR _status =
IF (
MAX ( 'VAccessControlLog'[EventDate] ) = __last_event_date
&& MAX ( 'VAccessControlLog'[DoorName] )
IN { "PERSONEL TURNİKE 01 GİRİŞ", "PERSONNEL TURNER 02 ENTRANCE" },
"Inside"
)
RETURN
_status
Best Regards,
Gao
Community Support Team
Hi @koray ,
Please create a new measure:
Status =
VAR __name = MAX('YourTableName'[Name])
VAR __last_event_date = CALCULATE(MAX('YourTableName'[Last Event Date]),FILTER(ALLSELECTED('YourTableName'),'YourTableName'[Name]=__name))
VAR _status = IF(MAX('YourTableName'[Last Event Date])=__last_event_date && MAX('YourTableName'[Door])="Entrance Turnstile","Inside")
RETURN
_status
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hello @v-cgao-msft
Thank you very much. I think it's working. I am very happy 🙂
I forgot one point. Can I add one more to the door names?
MAX('VAccessControlLog'[DoorName])="STAFF TURNER 01 ENTRANCE", "Inside")
I would like to add the PERSONNEL TURNER 02 ENTRANCE door in the door name section above. How should I make an arrangement?
Hi @koray ,
Please try:
Status =
VAR __name =
MAX ( VAccessControlLog[Name] )
VAR __last_event_date =
CALCULATE (
MAX ( VAccessControlLog[EventDate] ),
FILTER (
ALLSELECTED ( 'VAccessControlLog' ),
'VAccessControlLog'[Name] = __name
)
)
VAR _status =
IF (
MAX ( 'VAccessControlLog'[EventDate] ) = __last_event_date
&& MAX ( 'VAccessControlLog'[DoorName] )
IN { "PERSONEL TURNİKE 01 GİRİŞ", "PERSONNEL TURNER 02 ENTRANCE" },
"Inside"
)
RETURN
_status
Best Regards,
Gao
Community Support Team
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 |
---|---|
141 | |
106 | |
101 | |
85 | |
72 |