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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
SukanyaN
Regular Visitor

In Direct query mode, how to get Max(Date) from date slicer date range

Hi 

 

My requirement is to caluclate 12monthsrollingaverage from the selection daterange.

For that I need to store max value in measure so that can use this date in my further calculation.

 

I tried using SelectedValue() and AllSelected() but nothing worked.

 

Thanks

Sukanya

 

1 ACCEPTED SOLUTION
v-qiaqi-msftv
Community Support
Community Support

Hi @SukanyaN,

IThanks for the reply from 3CloudThomas.

 

I have made a simple demo for your reference:

vqiaqimsftv_0-1740623207603.png

MaxDateSelected = 
MAXX(
    FILTER(
        'Table', 
       'Table'[DELDATE] <= MAX('Table'[DELDATE])
    ), 
    'Table'[DELDATE]
)

 

Regards,

Qi

View solution in original post

2 REPLIES 2
v-qiaqi-msftv
Community Support
Community Support

Hi @SukanyaN,

IThanks for the reply from 3CloudThomas.

 

I have made a simple demo for your reference:

vqiaqimsftv_0-1740623207603.png

MaxDateSelected = 
MAXX(
    FILTER(
        'Table', 
       'Table'[DELDATE] <= MAX('Table'[DELDATE])
    ), 
    'Table'[DELDATE]
)

 

Regards,

Qi

3CloudThomas
Super User
Super User

Create a table in PowerQuery with the SQL SELECT MAX(DATECOLUMN) FROM TABLENAME. This will create a one column one row table with the maximum date from the table. Use it in your measures.

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.