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
rmcgrath
Advocate II
Advocate II

Dynamic date parameters?

Hello.  I would like to modify the following code snippet to refer to (2) cells in an Excel workbook (a cell for a start date and a cell for an end date)

 
VAR __DS0FilterTable5 = 
FILTER(
KEEPFILTERS(VALUES('Date Dim'[FiscalBaseDate])),
AND(
'Date Dim'[FiscalBaseDate] >= DATE(2024, 1, 1),
'Date Dim'[FiscalBaseDate] < DATE(2024, 2, 15)
1 ACCEPTED SOLUTION

You have loaded the data to power bi model right ? and if you are on live connection like direct mode then i think it will not load but only query it so try switching to import 
another way is you could use what if parameter instead of the parameter table itslef i guess

View solution in original post

5 REPLIES 5
Akash_Varuna
Community Champion
Community Champion

Hi Could you try this

VAR __StartDate =
CALCULATE(
MAX('ParameterTable'[ParameterValue]),
'ParameterTable'[ParameterName] = "StartDate"
)

VAR __EndDate =
CALCULATE(
MAX('ParameterTable'[ParameterValue]),
'ParameterTable'[ParameterName] = "EndDate"
)

VAR __DS0FilterTable5 =
FILTER(
KEEPFILTERS(VALUES('Date Dim'[FiscalBaseDate])),
AND(
'Date Dim'[FiscalBaseDate] >= __StartDate,
'Date Dim'[FiscalBaseDate] < __EndDate
)
)
If the post helped please give a kudos and accept this as a solution
Thanks in advance

Hi - probably a dumb question, but where are you getting "Parameter Table" from?

Sorry didnt share that as you need to create a table for that Prameter Table for start date and end date which will then dynamically filter without hardcoding it into DAX

Ah ok...well, I tried adding your code and made a parameter table in the Excel workbook that contains the live connection data, but it just keeps telling me it cannot find the parameter table?

You have loaded the data to power bi model right ? and if you are on live connection like direct mode then i think it will not load but only query it so try switching to import 
another way is you could use what if parameter instead of the parameter table itslef i guess

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

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