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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
Syndicate_Admin
Administrator
Administrator

Current day employee location

Good morning!

HR departments ask me to create as a table where you can see from where employees sign (if from HOME, OFFICE or OTHERS) on the current day.

We sign twice a day (entry and exit). For example, the following would have to come out:

USER

DAY

TYPE

LOCATION

Andrea

26/07/2022

Entrance

HOUSE

Andrea

26/07/2022

Exit

HOUSE

Martin

26/07/2022

Entrance

OFFICE

Martin

26/07/2022

Exit

OFFICE

Edgar

26/07/2022

Entrance

OFFICE

Edgar

26/07/2022

Exit

OFFICE

Currently he puts me every day, but I only need the current day or, failing that, the last one signed:

mariases94_0-1658820318917.png

I have the data, but I do not know how to make it appear only on the current day or, failing that, the last day signed. Can you help me?

Thanks in advance and greetings!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Syndicate_Admin ,

 

Please refer this formula.

Column = 
var last_day = CALCULATE(MAX('Table'[DAY]),FILTER('Table','Table'[USER]=EARLIER('Table'[USER])&&'Table'[TYPE]=EARLIER('Table'[TYPE])))
return
CALCULATE(MAX('Table'[LOCATION]),FILTER(ALLEXCEPT('Table','Table'[USER],'Table'[TYPE]),'Table'[DAY]=last_day))

 

Best Regards,

Jay

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Syndicate_Admin ,

 

Please refer this formula.

Column = 
var last_day = CALCULATE(MAX('Table'[DAY]),FILTER('Table','Table'[USER]=EARLIER('Table'[USER])&&'Table'[TYPE]=EARLIER('Table'[TYPE])))
return
CALCULATE(MAX('Table'[LOCATION]),FILTER(ALLEXCEPT('Table','Table'[USER],'Table'[TYPE]),'Table'[DAY]=last_day))

 

Best Regards,

Jay

MahyarTF
Memorable Member
Memorable Member

Hi,

Not sure what you mean, Would you please put your expectation as a sample in your post ?

But if you want to see just the first day, (day = 1), you could put the filter on your visual/page or report

 

Mahyartf
amitchandak
Super User
Super User

@Syndicate_Admin , You need to have timestamp for that or add index column in power query

 

 

 

Last Location = var _max = maxx(filter(ALLSELECTED(Data), Data[USER] = Max(Data[USER]) && Data[Date] = Max(Data[Date])), Data[Time])
return
CALCULATE(max(Data[Location]), filter((Data) , Data[Time] =_max))

 

Refer

https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0

https://amitchandak.medium.com/power-bi-get-the-sum-of-the-last-latest-value-of-a-category-f1c839ee8...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you very much, but it does not work, I have put the formula that you have told me in the column and in ALL users I get that they work from the office when it is not so. For example, this user last signed yesterday from CASA:

mariases94_0-1658822917179.png

I have used the formula that you have passed me, but adapted to my data:

Last Status = where _max = maxx(filter(ALLSELECTED('Presence control'), 'Presence control'[User] = Max('Presence control'[User])), 'Presence control'[EntryDate])
return
CALCULATE(Max([Location]), filter(('Presence control') , 'Presence control'[EntryDate] =_max))

I think there's something I haven't done right.

Thanks a lot!

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.