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
XZhu
Regular Visitor

Is it possible to have a query string with dynamic parameters when getting data?

Hi,

 

I have been assigned a task of transforming a Silverlight application using Power BI, and am currently stuck on a problem. As I am new to Power BI, I hope I can get some advices here if possible.

 

We have a Cube which has various Dimensions such as Adviser, Manager and Region Manager, and Measures such as Annual Premium, API and Sum Assured. The application is supposed to query corresponding Dimension and Measure depending on the role of the logged on user in the company. For example, if an Adviser logged on the application, it would query the Dimension 'Adviser' and Measure 'Annual Premium', whereas in the case of a Manager, Dimension 'Manager' and Measure 'API' would be queried.

 

This is easy to achieve in silverlight application, as the query string can be written with dynamic parameters as shown below, and the values of which can be passed in from C# code at run time. I have been searching on web for the way to achieve something similar on Power BI, but got no luck so far. 

 

select {{[Effective Date].[Date].MEMBERS}} on columns
from [Cube]
where ([Measures].[{2}],
[{1}].[Salesman Reference].[{0}])

 

 

Could anyone provide advice on whether this is possible with Power BI at the moment please? Much Appreciated!

 

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

@XZhu

 

In Power BI, you can use Query Parameter to achieve your goal. The Query Parameter can be used in Power Query (Query Editor->Advanced Editor) and concatenate into entire MDX query string to retrieve data. For more details, please refer to article below:

 

POWER BI DESKTOP QUERY PARAMETERS, PART2 – DYNAMIC DATA MASKING AND QUERY PARAMETERS

 

Regards,

View solution in original post

1 REPLY 1
v-sihou-msft
Employee
Employee

@XZhu

 

In Power BI, you can use Query Parameter to achieve your goal. The Query Parameter can be used in Power Query (Query Editor->Advanced Editor) and concatenate into entire MDX query string to retrieve data. For more details, please refer to article below:

 

POWER BI DESKTOP QUERY PARAMETERS, PART2 – DYNAMIC DATA MASKING AND QUERY PARAMETERS

 

Regards,

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.