Forum Discussion
Properly Referencing Field Parameters in a Measure
Edit: I am trying to convert a string reference into a column reference within a measure. After some more refined research, I do not think what I want is possible.
I created a field parameter table "Parameter-WE Date" shown below:
I have dozens of measures that reference the 'Calendar'[WE Date Sunday] but I need them to be dynamic and reference the result of the selected Field Parameter, 'Parameter-WE Date'[Parameter-WE Date_Fields].
Simply put in a DAX expression, I would like to have a measure like this:
Max WE Date = MAX('Parameter-WE Date'[Parameter-WE Date_Fields])This doesn't work since the value returned into the max function is text.
Is there a simple, scalable way to call on the [Parameter-WE Date_Fields] and treat the result as a column rather than text?
Thanks in advance.
(edit for clarity)
2 Replies
- amitchandakSuper User
PineTree , Not very clear, but you can use [Parameter-WE Date_Order] to get selected value. refer
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f
Power BI Field Parameters, Keep Axis Sort intact| Always Sort on X/Categorial Axis: https://youtu.be/GfBrB6czByw
- PineTreeRegular Visitor
Hello amitchandak , thank you for your response.
I made some minor edits to help with clarity.
To use the example you cited here to demonstrate my issue, lets first pretend 'Item'[Brand] and 'Item'[Category] are numeric values (maybe cost and revenue?). Now lets find the maximum value in 'Item'[Brand]/'Item'[Category] based on the Parameter selected by the user by creating a measure...
New Measure = Max('Parameter'[Parameter Fields])
This won't work because the value of 'Parameter'[Parameter Fields] is being treated as text and not as a column reference.
Do you know how to make [New Measure] work?
Does this provide enough clarity?Thank you for your time amitchandak