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]) )
Anonymous
1 year agoNot applicable
Hi user01 ,
I create a table as you mentioned.
Then I think you can create a measure and here is the DAX code.
SelectedValueMeasure =
SWITCH(
TRUE(),
SELECTEDVALUE('Parameter'[Parameter]) = "Amount", SUM('Table'[Amount]),
SELECTEDVALUE('Parameter'[Parameter]) = "Employee", SUM('Table'[Employee])
)
You can use them and it will give you what you want.
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.
user01
Resolver I
1 year agoAnonymous
I got the following error:
Error fetching data for this visual
MdxScript(Model) (12, 5) Calculation error in measure 'Data2'[SelectedValueMeasure]: Column
[Parameter] is part of composite key, but not all columns of the composite key are included in the
expression or its dependent expression.