I'm looking for a way to integrate a previously retrieved list as an input for a FILTER in a MDX query. I currently have the following code:
segment_var = Segment,
mdxQ = "SELECT
NON EMPTY ( { [Measures].[AMT] * [Forecast Type].[Forecast Type].[Forecast Level 2] } ) DIMENSION PROPERTIES MEMBER_NAME ON COLUMNS,
NON EMPTY ( {
[Period].[Year Month Name].[Name] *
[PL Spec].[PL Spec].[Level 6 Code].allmembers
} ) ON ROWS
FROM (
SELECT ( { [Forecast Type].[Current Indicator].&[Y] } ) ON COLUMNS
FROM (
SELECT ( { [PL Spec].[PL Spec].[Level 1 Code].&[101] } ) ON COLUMNS
FROM [AIR]))
WHERE (
FILTER([Management Structure - Segment].[Management Structure - Segment].[MS Level 5].ALLMEMBERS , [Management Structure - Segment].[Management Structure - Segment].currentmember.name=""" & segment_var & """))",
Segment on row 1 used to be a single value parameter but I want to use a list of segments (listSegment) as a reference instead so the result filters multiple segments. I've tried WHERE IN solutions but I can't seem to get it to work. Any help would be appreciated.
Error:
Expression.Error: We cannot apply operator & to types Text and List.
Managed to solve the issue in the following way:
Code:
Convert =
Table.ToList(
Table.Transpose(
Table.FromList(#"Distinct")),
Combiner.CombineTextByDelimiter(", ")),
Var = List.First(Convert)