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
LauraH9274
Frequent Visitor

Dynamic M Query Date Parameter Slicer Not Working

I want a date slicer in my report to update the paramater in my query to filter my data. 

I've followed the documentation on MS, and have tested with a text value (which worked fine) but I cannot get the date to update.

Pleasee see screenshots attached, does anyone know what I might be doing wrong? The data types are both Date, the StartDate column is bound to the parameter, it just does not work.

Thanks in advanced.

 

image.png

LauraH9274_0-1717687975281.pngLauraH9274_1-1717687981835.png

LauraH9274_2-1717687988144.png

LauraH9274_3-1717687993911.png

 

1 ACCEPTED SOLUTION

Okay @LauraH9274,

 

Okay perfect.

Next you need a dynamic list of your Min and Max MIN_PAYLOAD_DATE Colum. This is the Code:

Name this query "MinPayloadDates"

let
    // Step 1: Copy of Your Source Query
    Source = YourSourceQuery,
    
    // Step 2: Min und Max Date from Your Source Query
    MinDate = List.Min(Source[MIN_PAYLOAD_DATE]),
    MaxDate = List.Max(Source[MIN_PAYLOAD_DATE]),
    
    // Step 3: Liste der Daten erstellen
    DateListe = List.Dates(MinDate, Duration.Days(MaxDate - MinDate) + 1, #duration(1,0,0,0))
in
    DateListe

 

Next you must edit your Parameter like this:

ManuelBolz_0-1717756395154.png


Now when you save and close you cand change the parameter in Power BI Desktop:

ManuelBolz_3-1717757524034.png

 

Best regards from Germany
- Manuel

View solution in original post

7 REPLIES 7
ManuelBolz
Responsive Resident
Responsive Resident

Hello @LauraH9274,

do you see the button "Edit parameter" (sorry german Version) from my screenshot in Power BI Desktop?

 

ManuelBolz_0-1717754826805.png

I guess not, since you create your date values ​​statically via DAX. I assume you want to query and parameterize these dynamically via Power Query.

 

Best regards from Germany
- Manuel

Hi Manuel, 

I do see this, it allows me to edit the date

Okay @LauraH9274,

 

Okay perfect.

Next you need a dynamic list of your Min and Max MIN_PAYLOAD_DATE Colum. This is the Code:

Name this query "MinPayloadDates"

let
    // Step 1: Copy of Your Source Query
    Source = YourSourceQuery,
    
    // Step 2: Min und Max Date from Your Source Query
    MinDate = List.Min(Source[MIN_PAYLOAD_DATE]),
    MaxDate = List.Max(Source[MIN_PAYLOAD_DATE]),
    
    // Step 3: Liste der Daten erstellen
    DateListe = List.Dates(MinDate, Duration.Days(MaxDate - MinDate) + 1, #duration(1,0,0,0))
in
    DateListe

 

Next you must edit your Parameter like this:

ManuelBolz_0-1717756395154.png


Now when you save and close you cand change the parameter in Power BI Desktop:

ManuelBolz_3-1717757524034.png

 

Best regards from Germany
- Manuel

Thank you Manuel! I have implemented this.

 

Do you know if it would still possible to use a slicer to update this parameter?

 

Thanks

Hallo @LauraH9274,

I think what you're trying to do isn't possible. But maybe you can explain again why you want to parameterize your query. Maybe there is another solution?

  • Do you have too much data?
  • Is your dataset too slow?
  • Maybe you need RLS (Row Level Security)?


Best regards from Germany
Manuel Bolz


If this post helped you, please consider Accept as Solution so other members can find it faster.

🤝Follow me on LinkedIn

LauraH9274
Frequent Visitor

Hi @jennratten , thanks for your response. 
It worked on a text column, and the script was the same except for a different parameter and different column names. 
The query at the moment is responsive to the parameter, so if i change the parameter manually to be a different date, this does filter the query, it just doesn't interact with the slicer in the report view. As soon as I add a slicer to the page, any visuals just go blank.
Not quite sure I understand what passing the date as text would do, as the slicer is still in a date format, could you elaborate please?

Much appreciated

jennratten
Super User
Super User

Hi @LauraH9274 - I believe you need to convert the date to text in Power Query and then pass that back to your source, such as in the example below.

Date.ToText ( ParameterStartDate, "yyyy-MM-dd" )

 

When you it worked for you as a text value, was that for some other field or passing the date as text?  Where did you have that placed in the script? Was it in the source step or in one of the later steps like your date filter?  When you use the query as you currently have it configured, what happens?  Nothing?  An error?  What error?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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 Kudoed Authors