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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Ayyappa5678
Helper III
Helper III

DAX with Today (text data type), Last 7 dates(with text data type) and future dates(date data type)?

Hi Team,

I am new to power bi.

Kindly please help me below dax issue with date dropdown filter.

Like, Today date with Text Data Type

         Last 7 days with Text Data Type

          and Future dates with Date Data Type.

Kindly please he me on this case. I need to go all above cases in one dropdown filter. please help me best approch? 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Ayyappa5678 ,

I created some data:

Are you referring to the selection of the slicer to display the corresponding date.

Table1:

vyangliumsft_0-1694577536845.png

Table2:

vyangliumsft_1-1694577536847.png

 

Here are the steps you can follow:

1. Create measure.

Flag =
var _select=SELECTEDVALUE('Table'[Slicer])
var _today=TODAY()
return
SWITCH(
    TRUE(),
    _select="Today"&&MAX('Table 2'[Date])=_today,1,
    _select="Last 7 dates"&&MAX('Table 2'[Date])>=_today-7&&MAX('Table 2'[Date])<_today,1,
    _select="future dates"&&MAX('Table 2'[Date])>_today,1,0)

 2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_2-1694577577146.png

3. Result:

vyangliumsft_3-1694577577148.png

 

 

Best Regards,

Liu Yang

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

View solution in original post

3 REPLIES 3
Ashok507
Frequent Visitor

I think it can be achieved using

"detect data type" option in" transform" tab of "power query editor"me.

No it is not working we will go with dax commands.
please suggest with DAX command!

Anonymous
Not applicable

Hi  @Ayyappa5678 ,

I created some data:

Are you referring to the selection of the slicer to display the corresponding date.

Table1:

vyangliumsft_0-1694577536845.png

Table2:

vyangliumsft_1-1694577536847.png

 

Here are the steps you can follow:

1. Create measure.

Flag =
var _select=SELECTEDVALUE('Table'[Slicer])
var _today=TODAY()
return
SWITCH(
    TRUE(),
    _select="Today"&&MAX('Table 2'[Date])=_today,1,
    _select="Last 7 dates"&&MAX('Table 2'[Date])>=_today-7&&MAX('Table 2'[Date])<_today,1,
    _select="future dates"&&MAX('Table 2'[Date])>_today,1,0)

 2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_2-1694577577146.png

3. Result:

vyangliumsft_3-1694577577148.png

 

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

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!

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.

Users online (25)