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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
kavster
Frequent Visitor

DAX LastDate? Problem

Hi, I wonder if someone can help me get past this road block.  I have tried so many options (mainly around virtual tables and dax last date) I think my approach must be wrong.

 

I have two tables; the first a date table (below left) with a column showing the period and year that each date falls into (13 financial periods of 4 weeks).  

 

In the second table (below right) I have the same financial period format column; I am trying to build a calculated column in this second table that returns the last date only of each period using the date table.  No relationship between tables, multiple values in FY-Period columns of both tables (date column is unique).  

kavster_0-1647210397450.png

 

Thank you.

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

hi @kavster 

 

I think the best way is to first create a summarized table : 

last_date_table_period = SUMMARIZE(
'Periods and Weeks','Periods and Weeks'[FY-Period],"last_date", LASTDATE('Periods and Weeks'[Date]))
 
after that you add a coulmn in the full_schedule_data : 
last_date = LOOKUPVALUE(
last_date_table_period[last_date],last_date_table_period[FY-Period],Full_Schedule_Data[Period_FY]
)
 
Did I answer your question? Thanks to mark my post as a solution 😁

 

View solution in original post

Yep, you nailed it.  Brilliant thank you for the help, works perfectly. 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

hi @kavster 

 

I think the best way is to first create a summarized table : 

last_date_table_period = SUMMARIZE(
'Periods and Weeks','Periods and Weeks'[FY-Period],"last_date", LASTDATE('Periods and Weeks'[Date]))
 
after that you add a coulmn in the full_schedule_data : 
last_date = LOOKUPVALUE(
last_date_table_period[last_date],last_date_table_period[FY-Period],Full_Schedule_Data[Period_FY]
)
 
Did I answer your question? Thanks to mark my post as a solution 😁

 

Yep, you nailed it.  Brilliant thank you for the help, works perfectly. 

Anonymous
Not applicable

  • hello, can you add a file pbix?

PBIX file at link below.

https://drive.google.com/file/d/1kIGdn4PguMTHg7LBqL9G-H0jP9RpxmV-/view?usp=sharing

 

What I am trying to achieve is a new calculated column in the Full_Dchedule_Data_Table by looking up the Period_FY date (blue box) in the Period and Weeks Table (red box) and returing the Date (green box).  But it need to be the latest date in that period.  So for example P11_2021 would return a date in the calculated column of 05 Feb 2022, which would be on all rows where the FY_Period is P11_2021.

kavster_1-1647339262519.png

 

kavster_2-1647339552023.png

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.