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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Calculated column that says "Yes" if someone worked the last week

Hello everybody, 

 

I have data with two columns, Date and Driver

Date has the first day of every week and Driver has names

Each row tells if a driver attended to work each week.

I need to generate a column to know if the driver attended to work considering the lattest week available in the field data.

There will be only dates with the first day of the week.

For example:

aguuzdo_0-1644876744317.png

 

 

I need this to segment my data in the dashboard.

 

Thanks in advance

1 ACCEPTED SOLUTION
TheoC
Super User
Super User

Hi @aguuzdo 

 

You can use the following Calculated Column:

 

Worked This Week = 

VAR _1 = Table[Driver]
VAR _2 = CALCULATE ( LASTDATE ( 'Table'[Date] ) , ALLEXCEPT ( 'Table' , t[Driver] ) )

RETURN

IF ( _2 = MAX ( 'Table'[Date] ) , "YES" , "NO" )

Output as per below:

TheoC_0-1644889786965.png

 

In addition to the above, if you wanted to have YES only for the worker and the most recent date, then you can adjust the calculated column to the following:

 

Attendance = 

VAR _Name = Table[Driver]
VAR _Date = MAXX ( FILTER ( ALL ( 'Table' ) , Table[Driver] = _Name ) , Table[Date] )

RETURN

IF ( _Date = 'Table'[Date] , "YES" , "NO" )

Output looks like this:

 

TheoC_1-1644889786966.png

 

 

Hope this helps!

Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

3 REPLIES 3
TheoC
Super User
Super User

Hi @aguuzdo 

 

You can use the following Calculated Column:

 

Worked This Week = 

VAR _1 = Table[Driver]
VAR _2 = CALCULATE ( LASTDATE ( 'Table'[Date] ) , ALLEXCEPT ( 'Table' , t[Driver] ) )

RETURN

IF ( _2 = MAX ( 'Table'[Date] ) , "YES" , "NO" )

Output as per below:

TheoC_0-1644889786965.png

 

In addition to the above, if you wanted to have YES only for the worker and the most recent date, then you can adjust the calculated column to the following:

 

Attendance = 

VAR _Name = Table[Driver]
VAR _Date = MAXX ( FILTER ( ALL ( 'Table' ) , Table[Driver] = _Name ) , Table[Date] )

RETURN

IF ( _Date = 'Table'[Date] , "YES" , "NO" )

Output looks like this:

 

TheoC_1-1644889786966.png

 

 

Hope this helps!

Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=if(CALCULATE(max(Data[Date]),FILTER(Data,Data[Driver]=EARLIER(Data[Driver])))=MAX(Data[Date]),"Yes","No")

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
TheoC
Super User
Super User

Hi @Anonymous 

 

You can use the following Calculated Column:

 

Worked This Week = 

VAR _1 = Table[Driver]
VAR _2 = CALCULATE ( LASTDATE ( 'Table'[Date] ) , ALLEXCEPT ( 'Table' , t[Driver] ) )

RETURN

IF ( _2 = MAX ( 'Table'[Date] ) , "YES" , "NO" )

Output as per below:

TheoC_0-1644878856062.png

In addition to the above, if you wanted to have YES only for the worker and the most recent date, then you can adjust the calculated column to the following:

 

Attendance = 

VAR _Name = Table[Driver]
VAR _Date = MAXX ( FILTER ( ALL ( 'Table' ) , Table[Driver] = _Name ) , Table[Date] )

RETURN

IF ( _Date = 'Table'[Date] , "YES" , "NO" )

Output looks like this:

 

TheoC_1-1644879308472.png

 

Hope this helps!

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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