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

The Fabric community is upgrading! Read all of the details including the timeline and what you can expect. Learn more

Reply
sshiny
Helper II
Helper II

Issue with Date function

My data is filtered when I hardcode as shown below.

 

Table =

VAR DateStart = DATE("2022", "11", "1")
VAR DateEnd = DATE("2023", "1", "5")

RETURN
  CALCULATETABLE(
      'Recorded Orders Fact',
      FILTER('Recorded Orders Fact','Recorded Orders Fact'[Order Date] <= DateEnd && 'Recorded Orders Fact'[Order Date] >= DateStart)
  )
 
But, I am unable to get the filtered data when I was the function TODAY(), MAX or LASTDATE. Please help me find the DAX . The below code does not filter the data.
Table =

VAR DateStart = MAX('Recorded Orders Fact'[Order Date])
VAR DateEnd   = MAX('Recorded Orders Fact'[Order Date]) - 30

RETURN
  CALCULATETABLE(
      'Recorded Orders Fact',
      FILTER('Recorded Orders Fact','Recorded Orders Fact'[Order Date] <= DateEnd && 'Recorded Orders Fact'[Order Date] >= DateStart)
  )
2 REPLIES 2
Mahesh0016
Super User
Super User

@sshiny 
Table =

 

VAR DateStart = MAX('Recorded Orders Fact'[Order Date])
VAR DateEnd   = MAX('Recorded Orders Fact'[Order Date]) - 30

 

RETURN
  CALCULATETABLE(
      'Recorded Orders Fact',
      FILTER('Recorded Orders Fact','Recorded Orders Fact'[Order Date] <=DateStart  && 'Recorded Orders Fact'[Order Date] >=DateEnd )
  )

*If this post helps, please consider accept as solution to help other members find it more quickly and Appreciate your Kudos.

amitchandak
Super User
Super User

@sshiny , Change position of start and end , start should be smaller

 

VAR DateEnd = MAXX(allselected('Recorded Orders Fact'),'Recorded Orders Fact'[Order Date])
VAR DateStart = MAXX(allselected('Recorded Orders Fact'),'Recorded Orders Fact'[Order Date]) - 30

RETURN
CALCULATETABLE(
'Recorded Orders Fact',
FILTER('Recorded Orders Fact','Recorded Orders Fact'[Order Date] <= DateEnd && 'Recorded Orders Fact'[Order Date] >= DateStart)
)

 

If needed use allselected

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.