Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
ryancaralis
Frequent Visitor

Use Parameter to select measure and apply selected measure to color gradient conditional formatting

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:

ryancaralis_0-1724877851966.png

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:

ryancaralis_1-1724877887303.png

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!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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]":

vjunyantmsft_0-1724908426310.png


Here I build a sample data myself:

vjunyantmsft_1-1724908467574.png

 

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:

vjunyantmsft_2-1724908532580.png

 

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:

vjunyantmsft_3-1724908598154.png

And the final output is as below:

vjunyantmsft_4-1724908615538.png

vjunyantmsft_5-1724908623947.png

 




 

vjunyantmsft_6-1724908631644.png


And you can also don't use Field parameter, just add another table for slicer like this:

vjunyantmsft_7-1724908672191.png

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:

vjunyantmsft_8-1724908764182.png

And the final output is as before:

vjunyantmsft_9-1724908786527.png

vjunyantmsft_10-1724908794096.png

 

vjunyantmsft_11-1724908802065.png


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.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

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]":

vjunyantmsft_0-1724908426310.png


Here I build a sample data myself:

vjunyantmsft_1-1724908467574.png

 

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:

vjunyantmsft_2-1724908532580.png

 

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:

vjunyantmsft_3-1724908598154.png

And the final output is as below:

vjunyantmsft_4-1724908615538.png

vjunyantmsft_5-1724908623947.png

 




 

vjunyantmsft_6-1724908631644.png


And you can also don't use Field parameter, just add another table for slicer like this:

vjunyantmsft_7-1724908672191.png

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:

vjunyantmsft_8-1724908764182.png

And the final output is as before:

vjunyantmsft_9-1724908786527.png

vjunyantmsft_10-1724908794096.png

 

vjunyantmsft_11-1724908802065.png


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!

amitchandak
Super User
Super User

@ryancaralis , This is an example

Field Parameters- Conditional Formatting: https://amitchandak.medium.com/field-parameters-conditional-formatting-517aacc23fdf

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.