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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

DAX to create a date filter

Hello,

 

Can anyone help me with creating a date filter to include all dates in the range of past 6 months and next 6 months relative to today's date..assuming date_dt is the date field

6 REPLIES 6
dax
Community Support
Community Support

Hi @Anonymous ,

You could refer to @amitchandak ' suggestions, or you also could try to +/-180 days like below

Measure = CALCULATE(SUM(t2[amount]), FILTER(t2, t2[date]<=DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY())+180)&& t2[date]>=DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY())-180)))

713.PNG

Best Regards,
Zoe Zhi

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

Anonymous
Not applicable

Thanks Zoe Zhi

amitchandak
Super User
Super User

@Anonymous ,

Measure =
var _min = date(year(today()),month(today())-6,day(today())) /// or date(year(today()),month(today())-6,1)
var _max = date(year(today()),month(today())+6,day(today())) /// eomonth(date(year(today()),month(today())+6,day(today())),0)
return
calculate([measure],filter(All(DATE), Date[Date] >=_min && Date[Date] <=_max))

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
Anonymous
Not applicable

Thanks Amit

nandukrishnavs
Community Champion
Community Champion

@Anonymous 

 

Try something like this 

 

Measure  = CALCULATE(SUM(MyTable[Sales]),FILTER(ALL(MyTable[date_dt]),MyTable[date_dt]>=TODAY()-180 || MyTable[date_dt]<= TODAY()+180))

 



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Anonymous
Not applicable

Thanks Nandu

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors