Forum Discussion
Using Bex Query to import data into power bi
- Anonymous6 years ago
Hi Anonymous
You are truely a saver.....
I will be often connecting with you hereafter...
I would like to appreciate you alot . Thank you
Regards,
Husna
Change your code to the following (Removing all the # and ")
CurrentDate = DateTime.LocalNow(),
CurrentMonth = Date.AddMonths(CurrentDate, -1),
Monthex = Number.ToText(Date.Month(CurrentMonth)),Then pass in this way
[Cube.ApplyParameter, "[ZSUSRPER]", {Monthex, Monthex}},
Keep in mind I hand coded this so there may be a mistake that would prevent you from copying the code but you should get the idea. Notice I removed all the # and " from the fields.
I appolgize, you can actually keep the #" in all the fields and it works just fine. I guess I've just never done it that way.
I think it may have something to do with the way you are creating the data. Date's in SAP are typically in an integer format '20200101' rather than a true date '01/01/2020', etc.
Can you do me a favor and connect to the query selecting dates from the paramter drop down and then past your M-Code. This will allow you to see the format of the parameters that you need to pass in. For example, if I just connect to the query and select the dates from the drop downs I get the following;
{Cube.ApplyParameter, "[0I_DAYS]", {"[ZSD_IS02___F13].[20200101]", "[ZSD_IS02___F13].[20200201]"},This allows me to see how we need to format the value that is being passed into the parameter. In my original post we were dealing with Fiscal Period so the values was actually '[0FISCPER].[K1220180001]' and in this case you have to make sure that you are passing in the parameter correctly. You'll have to include the 'K12' part of the value and then append the date to this value.
Does that make sense?