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
reneincer
Advocate II
Advocate II

How does passing a parameter to MDX works?

Hi community!

 

I am using a SSAS model with Import option and MDX queries, I have read many posts about passing parameters to queries, and all those posts are linked to this:

http://community.powerbi.com/t5/Desktop/Create-a-list-then-pass-as-parameters-to-TSQL/m-p/97761#M411...


Is there a new way to do this? I think it would be great if someone only selects a column and make it parameter and this parameter is auto embedded in source query.

 

I know you can select a column in the edit queries sections and assign it a parameter, but what I dont know is, does PowerBI extracts all data and then apply the parameter? or, does it pass the parameter before execution? If it is the later, thats the reason I need to pass the parameter directly in the query.

 

My query is very simple, Why passing a parameter is so complicated?

 

SELECT 
 NON EMPTY { [Measures].[Measure1], [Measures].[Measure2] } ON COLUMNS, 
 NON EMPTY {
 [GroupA].[Level].[Territory].ALLMEMBERS * 
 [GorupB].[Level].[SalesRegion].ALLMEMBERS } ON ROWS
FROM [Cube]
WHERE ( [ProcessDate].[Date].&[2016-12-31T00:00:00] ) 


Suppose I want to pass process date, how could I achieve this? I dont want to import all the table because my RAM crash, it is a very big cube (periodic snapshot),

 

Thanks

1 ACCEPTED SOLUTION

@reneincer

 

In Power BI, to use parameter, you can only generate a list with existing column and use it in your source query, like you already found. There's no other way.

 

And Power BI Query Editor extract all data first. After that if you apply parameter, it will re-generate the query with parameter selection as condition. It's unlike the parameters in Reporting Services. The Query Editor in SSRS will generate a hidden dataset for each parameter used in MDX.

 

In your scenario, I suggest you import the underlying dimension table into Power BI. Create a List with that date key column and use it to concatenate into a date member in your MDX.

 

Regards,

View solution in original post

2 REPLIES 2
reneincer
Advocate II
Advocate II

Hi community!

I am using a SSAS model with Import option and MDX queries,

I have read many posts about passing parameters to queries, and all those posts are linked to this topic (passing to SQL): http://community.powerbi.com/t5/Desktop/Create-a-list-then-pass-as-parameters-to-TSQL/m-p/97761#M411...


Is there a new way to do this? I think it would be great if someone only selects a column and make it parameter and this parameter is auto embedded in source query.

 

I know you can select a column in the edit queries sections and assign it a parameter, but what I dont know is, does PowerBI extracts all data and then apply the parameter? or, does it pass the parameter before execution? If it is the later, thats the reason I need to pass the parameter directly in the query.

 

My query is very simple, Why passing a parameter is so complicated?

 

SELECT 
 NON EMPTY { [Measures].[Measure1], [Measures].[Measure2] } ON COLUMNS, 
 NON EMPTY {
 [GroupA].[Level].[Territory].ALLMEMBERS * 
 [GorupB].[Level].[SalesRegion].ALLMEMBERS } ON ROWS
FROM [Cube]
WHERE ( [ProcessDate].[Date].&[2016-12-31T00:00:00] ) 


Suppose I want to pass process date, how could I achieve this?

 

Thanks

@reneincer

 

In Power BI, to use parameter, you can only generate a list with existing column and use it in your source query, like you already found. There's no other way.

 

And Power BI Query Editor extract all data first. After that if you apply parameter, it will re-generate the query with parameter selection as condition. It's unlike the parameters in Reporting Services. The Query Editor in SSRS will generate a hidden dataset for each parameter used in MDX.

 

In your scenario, I suggest you import the underlying dimension table into Power BI. Create a List with that date key column and use it to concatenate into a date member in your MDX.

 

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.