I have the following code to create a new Table in PowerBI based on a condition:
VAR Auswahl = SELECTEDVALUE('Y-Achse-Langzeit'[Parameter])
VAR Tabelle = ADDCOLUMNS(
'Daten Langzeitanalyse',
"Prüfungstyp_NIO",
SWITCH(
TRUE(),
'Daten Langzeitanalyse'[AVO_STATUS_DIP_INNENR] = "NIO", "Innenraum_Langzeit",
'Daten Langzeitanalyse'[AVO_STATUS_DIP_GETRIEBE] = "NIO", "Getriebeöl_Langzeit",
'Daten Langzeitanalyse'[AVO_STATUS_DIP_KK1] = "NIO", "KK1_Langzeit",
'Daten Langzeitanalyse'[AVO_STATUS_DIP_KK2] = "NIO", "KK2_Langzeit",
"unbekannt"
)
)
VAR Tabelle_02 = FILTER(Tabelle, [Prüfungstyp_NIO] = Auswahl)
RETURN Tabelle_02
The line:
SELECTEDVALUE('Y-Achse-Langzeit'[Parameter])
comes from a field-parameter, which returns either “Innenraum_Langzeit”, “Getriebeöl_Langzeit”, “KK1_Langzeit” or “KK2_Langzeit”.
Now, for some reason, the statement
VAR Tabelle_02 = FILTER(Tabelle, [Prüfungstyp_NIO] = "Innenraum_Langzeit")
always returns an empty Table which does not make any sense for me, because if i put in the result of the SELECTEDVALUE Function manually for example
VAR Tabelle_02 = FILTER(Tabelle, [Prüfungstyp_NIO] = "Innenraum_Langzeit")
Tabelle_02 contains the desired result, but not “dynamically” how I need it.
The general reason why I need this is to avoid having to change the status (“NIO”) via another slicer when selecting a button.
I tried to force the slicer output into a string-type but I dont’t get a type error or anything.