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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.