Dynamic Parameter in MDX Query (PQ)

cr731

Well-known Member
Joined
Sep 17, 2010
Messages
611
I'm using Power Query to connect to a SSAS database and I am trying to make the time portion of the filters dynamic. I need to build a string that looks like this,

[Time].[Time].[Period].&[2017]&[1], [Time].[Time].[Period].&[2017]&[2], [Time].[Time].[Period].&[2017]&[3]

Where the number of elements is dynamic - so if it is March, then the string should look as above, but then in April, it should be

[Time].[Time].[Period].&[2017]&[1], [Time].[Time].[Period].&[2017]&[2], [Time].[Time].[Period].&[2017]&[3], [Time].[Time].[Period].&[2017]&[4]

I have a basic table with my Parameters that looks like this

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Year[/TD]
[TD]Start Month[/TD]
[TD]End Year[/TD]
[TD]End Month[/TD]
[/TR]
[TR]
[TD]2017[/TD]
[TD]1[/TD]
[TD]2017[/TD]
[TD]3[/TD]
[/TR]
</tbody>[/TABLE]

But I can't figure out how to turn that into the string needed, repeating for each previous month.

Thanks
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,225,730
Messages
6,186,698
Members
453,369
Latest member
positivemind

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top