Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowTry your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now
Hello, I am a beginner in DAX, need help with the below problem:
Goal is to achieve the last date & no.of field columns. Last date is nothing but the attendance date of that store employee that he worked and how many days has it been from today to his/her last date.
Remember: Store supervisor, store employee# are in one dimension and date is coming from another calendar dimension table.
In which table is it best to create dax for this ??
Expected results should be like this:
| Last Date | No.of days |
| 10-Jun-2020 | 926 days |
| 15-Jun-2020 | 921 days |
Below is the sample data:
| Store Supervisor | Store Employee | Employee# | Attendance Date | Last date | no.of days= last date to today |
| Braden | Brad | 3425 | 16-Jan-20 | ||
| Braden | Brad | 3425 | 19-Jan-20 | ||
| Braden | Brad | 3425 | 10-Jun-20 | 10-Jun-2020 | 926 days |
| Jessica | Messi | 9879 | 24-Feb-20 | ||
| Jessica | Messi | 9879 | 16-May-20 | ||
| Jessica | Messi | 9879 | 15-Jun-20 | 15-Jun-2020 | 921 days |
Solved! Go to Solution.
Hi,
I do not know how your datamodel looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
I hope the below can provide some ideas on how to create a solution for your datamodel.
Last date measure: =
IF (
HASONEVALUE ( Employee[Store Employee] ),
MAXX ( RELATEDTABLE ( Data ), Data[Attendance Date] )
)
Number of days measure: =
IF (
NOT ISBLANK ( [Last date measure:] ),
INT ( TODAY () - [Last date measure:] )
)
@Anonymous
Note : You can use
Hi,
I do not know how your datamodel looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
I hope the below can provide some ideas on how to create a solution for your datamodel.
Last date measure: =
IF (
HASONEVALUE ( Employee[Store Employee] ),
MAXX ( RELATEDTABLE ( Data ), Data[Attendance Date] )
)
Number of days measure: =
IF (
NOT ISBLANK ( [Last date measure:] ),
INT ( TODAY () - [Last date measure:] )
)
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 1 |
| User | Count |
|---|---|
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 |