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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
jomikk
Helper I
Helper I

Dynamically change query with button

Hi, I am querying to a SSAS database with MDX query. I was wondering if it is possible to add a +/- button to change the query dynamically in the report? So if I press -1 then it changes the query with -1 (I use integer datevalue) so that I get yesterdays report.

1 ACCEPTED SOLUTION

@jomikk,

You can add slicers in the report page and use slicers to filter your visuals to show yesterday data.  

Another option is to add parameter using "Manage Parameters" button in Query Editor , then you are able to enter parameter value by clicking  “Edit Queries” ->“Edit Parameters” as described in the following blogs.

http://biinsight.com/power-bi-desktop-query-parameters-part-1/
http://biinsight.com/power-bi-desktop-query-parameters-part2-dynamic-data-masking-and-query-paramete...

Regards,
Lydia

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

View solution in original post

4 REPLIES 4
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@jomikk,

When you connect to SSAS database using “Import” mode in Power BI Desktop, it is possible to change your query dynamically. You can pass parameter to the MDX source query as described in the following similar threads. Then you are able to enter parameter values and click invoke button to generate expected table.

https://community.powerbi.com/t5/Desktop/Passing-parameters-to-MDX-source-queries/m-p/98738
https://community.powerbi.com/t5/Desktop/Declare-parameters-for-SQL-query-in-Power-BI/td-p/195620

However, if you connect to SSAS database using “Connect Live” mode, it is not possible to change query dynamically.

Regards,
Lydia

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

Thanks! I am importing, not connecting live. The solutions linked seem like it is only possible to do it in the query editor? Can you add a button on the report page as well?

@jomikk,

You can add slicers in the report page and use slicers to filter your visuals to show yesterday data.  

Another option is to add parameter using "Manage Parameters" button in Query Editor , then you are able to enter parameter value by clicking  “Edit Queries” ->“Edit Parameters” as described in the following blogs.

http://biinsight.com/power-bi-desktop-query-parameters-part-1/
http://biinsight.com/power-bi-desktop-query-parameters-part2-dynamic-data-masking-and-query-paramete...

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Community Champion
Community Champion

Are you importing or live query?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors