cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alepage Member
Member

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

Accepted Solutions
Highlighted
az38 Regular Visitor
Regular Visitor

Re: How to use parameters in Power BI

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/

1 REPLY 1
Highlighted
az38 Regular Visitor
Regular Visitor

Re: How to use parameters in Power BI

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/