I have the following problem. I'm getting Data (Excel 365 - Power Query) from a Cube with "Get Data from Analysis Services". -> Selling Qty an Values for filtered years by week.
Every thing is fine if I use Filter, updatetime ca. 3-4 seconds:
#"Filtered Rows1" = Table.SelectRows(#"Added Items", each
(Cube.AttributeMemberId([#"Date.Year (4-4-5)"]) = "[Date].[Year 4-4-5].&["&
Number.ToText(2019) &"]" meta
[DisplayName = Number.ToText(2019)]
or Cube.AttributeMemberId([#"Date.Year (4-4-5)"]) = "[Date].[Year 4-4-5].&["&
Number.ToText(2020) &"]" meta
[DisplayName = Number.ToText(2020)]
)
Now I like to do that dynamic, so that I can get the years from a cell in excel. I use the following M-Function "fktGetNamedCellValue" for this:
let
Source = (FieldInput as text) =>
let Quelle = Excel.CurrentWorkbook(){[Name=FieldInput]}[Content],
Inhalt = Number.From(Quelle{0}[Column1])
in Inhalt
in Source
I replaced the years in the Filter-Step with the function. The cells are named "cell_Prev_Year" and "cell_Plan_Year" The cells in Excel formated as Numbers (and there are only Numbers in it) The updatetime now -> endless!!!
#"Filtered Rows1" = Table.SelectRows(#"Added Items", each
(Cube.AttributeMemberId([#"Date.Year (4-4-5)"]) = "[Date].[Year 4-4-5].&["&
Number.ToText(fktGetNamedCellValue("cell_Prev_Year") &"]" meta
[DisplayName = Number.ToText(fktGetNamedCellValue("cell_Prev_Year"))]
or Cube.AttributeMemberId([#"Date.Year (4-4-5)"]) = "[Date].[Year 4-4-5].&["&
Number.ToText(fktGetNamedCellValue("cell_Plan_Year")) &"]" meta
[DisplayName = Number.ToText(fktGetNamedCellValue("cell_Plan_Year"))]
)
If I use a "normal" parameter with the value "2019" or "2020" everything is fine. Only if I use the fktGetNamedCellValue it will not run correctly.
I`ed Trim an Clean the result. Formated it as Text and Number... nothing helped.
I have to use userfriendly Parameter (not set in Power Query) for this, so I hope for some help :)
Best Regards Chris
(PS: I hope u understand my english)