Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Help! - A measure to find the people recently logged in.

1.PNG

 

My Data looks like this -

I'm trying to find out the people/user-id recently logged in for the recent date.(that are currently inside the building)

A person can have multiple ins and outs.

Any help would be really great.

 

Thanks,

Anand!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous - Try this measure:

 

In Building =
var _MaxIn = CALCULATE (
    MAX ( 'Table'[SCAN_DATE_TIME] ),
    'Table'[SCAN_TY] = "IN"
)
var _MaxOut = CALCULATE (
    MAX ( 'Table'[SCAN_DATE_TIME] ),
    'Table'[SCAN_TY] = "OUT"
)
return _MaxIn > _MaxOut

Create a table visual with the user info and filter it by this new measure.

 

I hope this helps. If it does, please Mark as a solution.
I also appreciate Kudos.
Nathan Peterson

View solution in original post

4 REPLIES 4
Icey
Community Support
Community Support

Hi @Anonymous ,

Try this:

Recent log in =
CALCULATE (
    MAX ( 'Table'[SCAN_DATE_TIME] ),
    ALLEXCEPT ( 'Table', 'Table'[USER_ID], 'Table'[SCAN_TY] )
)

 recent.PNG

 

Best Regards,
Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks for your reply.

Since I have multiple Ins and Outs(which is filtered in the picture that I posted) I would like to see the people who are currently inside.

I believe I should compare the max value for in and out ; then if max in is greater that max out - I should be able to name that person as "currently in"

How do I do that?

Anonymous
Not applicable

@Anonymous - Try this measure:

 

In Building =
var _MaxIn = CALCULATE (
    MAX ( 'Table'[SCAN_DATE_TIME] ),
    'Table'[SCAN_TY] = "IN"
)
var _MaxOut = CALCULATE (
    MAX ( 'Table'[SCAN_DATE_TIME] ),
    'Table'[SCAN_TY] = "OUT"
)
return _MaxIn > _MaxOut

Create a table visual with the user info and filter it by this new measure.

 

I hope this helps. If it does, please Mark as a solution.
I also appreciate Kudos.
Nathan Peterson
Anonymous
Not applicable

Works!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.