Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi,
This post looks like the same question I have, and didn't have an answer: https://community.fabric.microsoft.com/t5/Desktop/Use-Parameter-to-return-dynamic-measure-field-for-...
I'm trying to use a parameter to select between different measures to use for a color gradient in a scatter plot. The parameter looks like this:
When I try to use the parameter value directly in the color gradient formatting, it only summarizes by count or count distinct instead of being able to use the measures that should pass to it. As a workaround, I created a measure that returns the selected measure based on the value selected in the parameter, it looks like this:
This also doesn't work. When I try to pass this measure to the color conditional formatting, the selection box comes up blank.
Is there a way to implement this correctly? I can use bookmarks as a workaround, but would rather use an approach like this and feel like it should work given the tools available.
Thanks for the help!
Solved! Go to Solution.
Hi @ryancaralis ,
Thanks for amitchandak's reply!
And @ryancaralis , if you want to use field parameter, please change the "SELECTEDVALUE" here into "MAX" and use "Parameter[Parameter]" instead of "Parameter[Parameter Fields]":
Here I build a sample data myself:
And create these measures:
_House = SUM('Table'[house])
_People = SUM('Table'[people])
People per house = SUM('Table'[people]) / SUM('Table'[house])
And I create Field parameter:
Then use this DAX to create the measure with Field parameter:
Measure 2 =
VAR _Slicer = MAX(Parameter[Parameter])
RETURN
SWITCH(
_Slicer,
"_People", [_People],
"_House", [_House],
"People per house", [People per house]
)
Use this measure to set conditional format:
And the final output is as below:
And you can also don't use Field parameter, just add another table for slicer like this:
Then use this DAX to create a measure:
Measure =
VAR _Slicer = SELECTEDVALUE(Slicer[Field])
RETURN
SWITCH(
_Slicer,
"People", [_People],
"House", [_House],
"People per house", [People per house]
)
And use this measure to set conditional format:
And the final output is as before:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @ryancaralis ,
Thanks for amitchandak's reply!
And @ryancaralis , if you want to use field parameter, please change the "SELECTEDVALUE" here into "MAX" and use "Parameter[Parameter]" instead of "Parameter[Parameter Fields]":
Here I build a sample data myself:
And create these measures:
_House = SUM('Table'[house])
_People = SUM('Table'[people])
People per house = SUM('Table'[people]) / SUM('Table'[house])
And I create Field parameter:
Then use this DAX to create the measure with Field parameter:
Measure 2 =
VAR _Slicer = MAX(Parameter[Parameter])
RETURN
SWITCH(
_Slicer,
"_People", [_People],
"_House", [_House],
"People per house", [People per house]
)
Use this measure to set conditional format:
And the final output is as below:
And you can also don't use Field parameter, just add another table for slicer like this:
Then use this DAX to create a measure:
Measure =
VAR _Slicer = SELECTEDVALUE(Slicer[Field])
RETURN
SWITCH(
_Slicer,
"People", [_People],
"House", [_House],
"People per house", [People per house]
)
And use this measure to set conditional format:
And the final output is as before:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is perfect, appreciate the step by step explanation thank you!
@ryancaralis , This is an example
Field Parameters- Conditional Formatting: https://amitchandak.medium.com/field-parameters-conditional-formatting-517aacc23fdf
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
110 | |
101 | |
97 | |
88 | |
68 |
User | Count |
---|---|
169 | |
133 | |
130 | |
103 | |
95 |