Forum Discussion
Create a Measure from Field Parameters
- 3 years ago
Anonymous I don't think this is going to work, in your measure you need to check which option is selected and then use the switch/if function to use the respective measure based on the selected value. check this post on how to get the selected value Using SELECTEDVALUE with Fields Parameters in Power BI - SQLBI
✨ Follow us on LinkedIn and to our YouTube channel
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.
I met very similar problem with you. What I did at the end is:
Under each field parameters, you have three columns, Name, Fields, Order. We can't use the Name and Fields in the if function becasue the PowerBI will tell us it's a composition key. But we can use order column.
Under Order column, each number represents one measure we have in our table. So for example, I will write as:
= If (Numeator'[Order] = 0, Table'[Count of A], if (Numeator'[Order] = 1, Table'[Count of B],Table'[Count of C])) / If (Denominator'[Order] = 0, Table'[Count of A], if (Denominator'[Order] = 1, Table'[Count of B],Table'[Count of C]))
Hope it helps.