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

Dynamic parameter for calendar with data source from SAP BW

Dear all,

May I get your help on below issue.

I create a report with data source from SAP BW that I have to select parameter of calendar (month) when getting data to the report. It is the fixed selection and I have to adjust the parameter after a period.
In case I want to get dynamic parameter (Ex: last month + current month) then I do not have to update the parameter anymore.

Below is the code of parameter:

{Cube.ApplyParameter, "[YCALMONT]", {{"[YORDMONTH].[202010]", "[YORDMONTH].[202011]", "[YORDMONTH].[202012]"}}},

Appreciate your advice.

Thank you!

 

4 REPLIES 4
Steels_Cat
Frequent Visitor

@v-alq-msft . Will be great if you provide the full solution of this topic. I have similar case.

v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

You may create two queries with the following codes to get lastmonth and current month and then refer to these two queries in other query. The pbix file is attached in the end.

Query1:

 

let
    Source = let 
d = DateTime.Date( DateTime.LocalNow())
in
Date.Year(d)*100+Date.Month(d)
in
    Source

 

 g1.png

 

Query2:

 

let
    Source = let 
d = DateTime.Date( DateTime.LocalNow()),
dlastmonth = Date.AddMonths(d,-1)
in
Date.Year(dlastmonth)*100+Date.Month(dlastmonth)
in
    Source

 

g2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Allan, Thank you for your post. Really helped me. But how do i apply this to my query? 

{Cube.ApplyParameter, "[YCMPERB]", {{"[0CALMONTH].[202301]"}}},

Did you find any solution to it 

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.

Top Solution Authors
Top Kudoed Authors