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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

How to use parameters in Power BI

Hello,

 

I have created two parameters named StartingDate and EndingDate.  A list of values is associated to each parameter.

 

When I import data from a sql table the following script is used.

 

select *

From Database1.TableA

Where FiscalPeriod between 200601 and 200612

 

This script works fine. But I would like to know how I can replace those two values for StartingDate and EndingDate.

Thanks in advance for your help

 

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi alepage

 

Try this

select *

From Database1.TableA

Where FiscalPeriod between @StartingDate and @EndingDate

So, there are a lot of information like this https://blog.crossjoin.co.uk/2016/12/11/passing-parameters-to-sql-queries-with-value-nativequery-in-...

 

Anyway, you can use parameter as a filter option which is pretty good described here https://powerbi.microsoft.com/ru-ru/blog/deep-dive-into-query-parameters-and-power-bi-templates/


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

1 REPLY 1
az38
Community Champion
Community Champion

Hi alepage

 

Try this

select *

From Database1.TableA

Where FiscalPeriod between @StartingDate and @EndingDate

So, there are a lot of information like this https://blog.crossjoin.co.uk/2016/12/11/passing-parameters-to-sql-queries-with-value-nativequery-in-...

 

Anyway, you can use parameter as a filter option which is pretty good described here https://powerbi.microsoft.com/ru-ru/blog/deep-dive-into-query-parameters-and-power-bi-templates/


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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