Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext 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
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:
I need this to segment my data in the dashboard.
Thanks in advance
Solved! Go to Solution.
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:
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:
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
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:
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:
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
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.
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:
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:
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
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 50 | |
| 44 | |
| 42 | |
| 19 | |
| 19 |
| User | Count |
|---|---|
| 70 | |
| 68 | |
| 33 | |
| 32 | |
| 32 |