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
Trammie
New Member

making sap hana parameters input dynamic

Hi,

 

I'm trying to connect a power BI report to a SAP HANA database which requires in put of a Date parameter. I've copied the DAX code that was generated below, relating to the "Report_Date" parameter.  Instead of typing in a fixed date, how can I change the parameter so that it is dynamic, say, based on yesterdays date.

 

    #"Added Items" = Cube.Transform(CV_STOCKS_SAPDIST_D1,        

            {Cube.AddAndExpandDimensionColumn, "[CV_STOCKS_SAPDIST_D20]", {"[CV_YCBPARTNR_DIM_SAPDIST].[YCBPARTNR]"}, {"Business Partner"}},

            {Cube.ApplyParameter, "Report_Date", {"20180731"}}

        }),

 

 

Thanks

Tram

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

Hi Trammie,

 

Try M code like below and check if it can work:

 

Date.AddDays(Date.From(DateTime.FixedLocalNow()),-1)

Regards,

Jimmy Tao 

View solution in original post

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

Hi Trammie,

 

Try M code like below and check if it can work:

 

Date.AddDays(Date.From(DateTime.FixedLocalNow()),-1)

Regards,

Jimmy Tao 

Great suggestion. 

 

I have used it as follows to get the current year and previous month, works like a charm.

 

Using System Date.png

 

The only drawback is : now the 'Added Items' screen can not be invoked, all further changes need to be done via the advanced query editor

 

Suneel_Chalis_0-1595818417347.png

 

Thanks!

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.