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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Susan513
Helper I
Helper I

user parameters for import query report

I have a report date field - that is set by me based on the month's reporting date, typically end of the month. This is used to calculate days between a task start date and this report date.

 

I would like to allow users of the report to change this date. So for example, if they wanted to see report data as of 6/16/2025 they could pick this date instead of my default 6/30/2025.

 

Is it possible to have this option via a parameter show before the report loads? I am not using to slice data - but to actually use for calculations of the data as it loads. I am using import query. I see ways to have a parameter in the report to slice data, but this is not exactly what i am trying to do.

 

If not, is there a quick way I can incorporate in the report itself, where the full report doesn't need refreshed with every date change? I have the report date in excel - and I know I can update the date here, then refresh - but trying to find a way to manage in power bi directly and avoid a refresh. The date is critical in a custom column in power quesry for calculations.

1 ACCEPTED SOLUTION
MarkLaf
Memorable Member
Memorable Member

It sounds like your query against the data source is not impacted by the reporting date in question, rather you are just looking to create a dynamic age measure where the start date is based on your data and the end date is based on a date selected by the user?

 

This is relatively straightforward, just make a new table of the dates you want the user to select from and then reference that in your age measure.

 

Here is an example with simple data and model.

 

Table

IDStartEnd
11/1/20251/20/2025
21/25/20253/1/2025
32/10/2025null
43/5/2025null
54/25/2025null

 

Here is a simple model where we already have a Dates table for time intelligence, etc.

 

MarkLaf_0-1750191449412.png

 

What we want to do is now create a new table that is unrelated from everything else in your model.

 

As an example, let's say we want people to select from the back half of 2025:

 

Date Select = 
CALENDAR( DATE( 2025, 7, 1 ), DATE( 2025, 12, 31 ) )

 

MarkLaf_2-1750191695847.png

 

New model:

 

MarkLaf_1-1750191595705.png

 

Now we can use this in a dynamic age measure, which will change based on the 'Date Select'[Date] selected in a slicer.

 

Dynamic Age = 
DATEDIFF( 
    MIN( 'Table'[Start] ), 
    MIN( 'Date Select'[Date] ), 
    DAY 
)

 

Or, here is an alternative where the age is based on the actual End Date and only uses the user-selected end date for open items (i.e. End Date is blank).

 

Dynamic Age_Open Only = 
DATEDIFF( 
    MIN( 'Table'[Start] ), 
    COALESCE(
        MIN( 'Table'[End] ),
        MIN( 'Date Select'[Date] )
    ), 
    DAY 
)

 

Here is a quick snip of this in action. We select 'Date Select'[Date] in the slicer, which impacts the age measures we defined above. The ages are based on MIN( 'Date Select'[Date] ), which is the equivalent of the Earliest Date card.

 

MarkLaf_3-1750192401981.gif

 

View solution in original post

5 REPLIES 5
MarkLaf
Memorable Member
Memorable Member

It sounds like your query against the data source is not impacted by the reporting date in question, rather you are just looking to create a dynamic age measure where the start date is based on your data and the end date is based on a date selected by the user?

 

This is relatively straightforward, just make a new table of the dates you want the user to select from and then reference that in your age measure.

 

Here is an example with simple data and model.

 

Table

IDStartEnd
11/1/20251/20/2025
21/25/20253/1/2025
32/10/2025null
43/5/2025null
54/25/2025null

 

Here is a simple model where we already have a Dates table for time intelligence, etc.

 

MarkLaf_0-1750191449412.png

 

What we want to do is now create a new table that is unrelated from everything else in your model.

 

As an example, let's say we want people to select from the back half of 2025:

 

Date Select = 
CALENDAR( DATE( 2025, 7, 1 ), DATE( 2025, 12, 31 ) )

 

MarkLaf_2-1750191695847.png

 

New model:

 

MarkLaf_1-1750191595705.png

 

Now we can use this in a dynamic age measure, which will change based on the 'Date Select'[Date] selected in a slicer.

 

Dynamic Age = 
DATEDIFF( 
    MIN( 'Table'[Start] ), 
    MIN( 'Date Select'[Date] ), 
    DAY 
)

 

Or, here is an alternative where the age is based on the actual End Date and only uses the user-selected end date for open items (i.e. End Date is blank).

 

Dynamic Age_Open Only = 
DATEDIFF( 
    MIN( 'Table'[Start] ), 
    COALESCE(
        MIN( 'Table'[End] ),
        MIN( 'Date Select'[Date] )
    ), 
    DAY 
)

 

Here is a quick snip of this in action. We select 'Date Select'[Date] in the slicer, which impacts the age measures we defined above. The ages are based on MIN( 'Date Select'[Date] ), which is the equivalent of the Earliest Date card.

 

MarkLaf_3-1750192401981.gif

 

This is great thank you. The user is typically putting in today's date - but I have a requirement that the date be the month end date the last week of the month. I like your approach, this makes total sense. Currently I have just implemented a power automate to update to todays date except for the specific days I want it to be the end of month. I will take a look at your solution, as I think this gives more flexibility in case they want to see a past date. My current solution is always today. I can add a field with the date, default to my date, then they can pick what they like. Then my calculation gets the date from the field whether their date or mine and we are golden. You are correct, I am just using for caclulation and not trying to change anything in the dataset. I just have to make sure the calculation updates when they change the date - which I am guessing would be a measure on the front, instead of in a column like I have currently. Thanks for the solution!

speedramps
Community Champion
Community Champion

The links are extactly what you require.

The example may not be a date, but if you use the same method it will work for a date.

Read the links again and try them.  They will work.

speedramps
Community Champion
Community Champion

Learn about power query parameters here

https://learn.microsoft.com/en-us/power-query/power-query-query-parameters

 

https://www.youtube.com/watch?v=twBUmqVOGgg

 

Learn about report parameters here

https://www.youtube.com/watch?app=desktop&v=wrKEyhSUaxQ

 

Please click thumbs up and accept solution

 

Thank you

Thank you for the links - none seem to help with a solution to my problem.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors
Top Kudoed Authors