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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
FZOU
Helper IV
Helper IV

Power query parameters

Hello,

I have a question please,can i set the value of the parameter StartYear or EndYear by a query like,
PBI Parameters.PNG
select Max(SalesYear) from Table. (T-sql,dax,m) no matter the programming language.. if yes how to do it and the table should be imported on power bi or in sql server ?

Thank you

3 REPLIES 3
v-eachen-msft
Community Support
Community Support

Hi @FZOU ,

 

You could create a date dimension with CALENDAR() or CALENDARAUTO() function. Then use the following DAX to set parameter in your current DAX formula but not for all DAX.

var _min = MIN('Table'[Date])
var _max = MAX('Table'[Date])

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-eachen-msft 
I already had a DimDate and that's is my question for this dimdate how can i set the start and end date dynamically via parameters or any other solution.

 

DimDate.PNG

MattAllington
Community Champion
Community Champion

yes, but then it is no longer a parameter. Create a new query that references your fact table. Click on the date column and select earliest from the date menu. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.