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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
lsalves
New Member

DAX FUNCTION DAY's

Has some dax function to filter dates as follows for 2 departments:
For the X department I need to filter dates before or the same as today!
For Y department I need to filter dates before or equal to today plus 2 days, excluding Saturday / Sunday for both situations.

2 REPLIES 2
DoubleJ
Solution Supplier
Solution Supplier

Hi

 

I made a small sample with a calendar table containing dates from 2017-03-20 until 2017-04-06.
Day_01.PNG

I then added a few columns:

 

Returns 1 if date is before or the same as today; otherwise 0

IsInPast = IF('Calendar'[Date].[Date] <= TODAY(),1,0)

 

 Calculates the day of week:

DayOfWeek = WEEKDAY('Calendar'[Date])

Returns 1 if date is before or equal to today plus 2 days; otherwise 0

IsBeforeEqualDayAfterTomorrow = IF(DATEADD('Calendar'[Date].[Date],-2;DAY) <= TODAY(),1,0)

 

Returns 1 if date is before or equal to today plus 2 days AND is not Saturday or Sunday; otherwise 0

IsBeforeEqualDayAfterTomorrow2 = IF(
DATEADD('Calendar'[Date].[Date],-2,DAY) <= TODAY()
&& 'Calendar'[DayOfWeek] <> 7
&& 'Calendar'[DayOfWeek] <> 1,1,0)

 

At the time of writing it is March 28, resulting in this table:

 

Day_02.PNG

 

You can now use these columns for slicers or your visual filters.

 

Hope this helps

JJ

 

 

 

 

 

 

Good suggestion, but I want the result using the CALCULATE / FILTER or other functions, however I am not hitting

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.