I have a need to change what column is shown on charts basis a slicer. In my data set I have Product Line and Product Name (multiple product names roll up to a single product line) and the users want to be able see their all their report charts break out by either based on what they choose as a slicer. I have created a "selection" table with single column with the values "Product Line" and "Product Name."
I'm trying to create a variable in my fact table that looks at my selection table and (given whatever the filter is showing) either equals Product Name or Product Line.
Here is my code essentially: Selection = Switch(Selection_Table[Selection], "PRODUCT NAME", <Fact>'Product Name', "Product Line",<Fact>'Product Line',"")
Even when I have a slicer to and choose a single value from the Selection Table I get an error that a single value cannot be determined. Any thoughts?