Forum Discussion
user01
Resolver I
1 year agoCreate a measure that returns values like a Field Parameter does
I have some dummy data below. I imported the example from Excel, but the true data will come from SQL Server via DirectQuery. I have a slicer for Category and a slicer for the Field Parameter. Th...
- 1 year ago
Anonymous
I made a change to your code and it worked. But do you know why it did not work when I did it your way?SelectedValueMeasure = SWITCH( TRUE(), SELECTEDVALUE('Parameter'[Parameter Fields]) = "'Table'[Amount]", SUM('Table'[Amount]), SELECTEDVALUE('Parameter'[Parameter Fields]) = "'Table'[Employee]", SUM('Table'[Employee]) )
user01
Resolver I
1 year agoAnonymous
I made a change to your code and it worked. But do you know why it did not work when I did it your way?
SelectedValueMeasure =
SWITCH(
TRUE(),
SELECTEDVALUE('Parameter'[Parameter Fields]) = "'Table'[Amount]", SUM('Table'[Amount]),
SELECTEDVALUE('Parameter'[Parameter Fields]) = "'Table'[Employee]", SUM('Table'[Employee])
)
Anonymous
1 year agoNot applicable
Hi user01 ,
From the error message, the problem is because the Parameter column is part of the composite key and your expression does not contain all the columns of the composite key.
So it needs to be presented with the full column, like the 'Table'[Amount] you modified.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.