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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

How to get a specific date

I have a column I need to filter. As of Now I have it like this:

 

BeforeToday_MI = IF(Query_Util[MoveInDate].[Date] < TODAY(), True, False) 
 
It returns True if MoveInDate column has dates prior to today. However, I want the function to return true if the date is before Today AND the day is not Saturday or Sunday; in other words, the date belong to a weekday and not a weekend.

 

I tried this but it's giving me error: 

BeforeToday_MI = IF(Query_Util[MoveInDate].[Date] < TODAY() && VALUE(Query_Util[MoveInDate].[Day]) <> "Saturday", True, False)
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous ,

 

BeforeToday_MI = IF( datevalues(Query_Util[MoveInDate]) < TODAY() && weekday(Query_Util[MoveInDate],2) <6 , True, False) 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous ,

 

BeforeToday_MI = IF( datevalues(Query_Util[MoveInDate]) < TODAY() && weekday(Query_Util[MoveInDate],2) <6 , True, False) 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

What if I want to get the days that are not Saturday or Sunday?

 

(My bad; I forgot to include that specification before. I need work days. Your code works perfectly; I just need to act the condition of filtering out Sunday as well.)

Hi @Anonymous ,

 

Did you get your problem solved? If it was solved, please mark it as a solution so that more people can find it. If not, refer to the following.

 

weekday(Query_Util[MoveInDate],2) return result follow the following rule.

week begins on Monday (1) and ends on Sunday (7).

 

If you only want filter out  sunday, then weekday(Query_Util[MoveInDate],2) <7. Or enter the day you want like this:

weekday(Query_Util[MoveInDate],2) = 1 &&

weekday(Query_Util[MoveInDate],2) = 2 &&

weekday(Query_Util[MoveInDate],2) = 3 &&

weekday(Query_Util[MoveInDate],2) = 4

 

More detail you can refer this function.

WEEKDAY function (DAX) - DAX | Microsoft Docs

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

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!

December 2024

A Year in Review - December 2024

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