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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Zeshansaif
Frequent Visitor

Using Fields Parameter to Create a Measure for Dynamic coloring complete column clustered /bar chart

I have a column chart i.e. "Sales by Category", I want a measure to change the colors of all columns of Y-axis based on field parameters. In the chart, Y-axis is Field Parameter, while X-axis is Category.

sample7.png

 


I tried using the following measures;

Color Measure =
SWITCH (
SELECTEDVALUE ( 'Monthly Comparison'[Monthly Comparison Fields] ),
"Sales", "#00FF00", // Green color for Sales
"Profit", "#FF0000", // Red color for Profit
"Number of Orders", "#0000FF", // Blue color for Number of Orders
"#EB895F" // Default color for other values
)

However, no matter what field I select, I am getting default color.

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @Zeshansaif 

Since a parameter table is a table designed for parameters, the engine does not allow you to apply conditions to it.

You simply need to add a helper column and apply the formula you wrote, which is correct in its logic, to the column you added.

Ritaf1983_0-1714879591571.pngRitaf1983_1-1714879636567.pngRitaf1983_2-1714879715103.png

Result :

Ritaf1983_3-1714879809517.pngRitaf1983_4-1714879826406.png

The pbix with my example is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

3 REPLIES 3
Zeshansaif
Frequent Visitor

Thankyou so much for your help 🙂

Happy to help 🙂

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Ritaf1983
Super User
Super User

Hi @Zeshansaif 

Since a parameter table is a table designed for parameters, the engine does not allow you to apply conditions to it.

You simply need to add a helper column and apply the formula you wrote, which is correct in its logic, to the column you added.

Ritaf1983_0-1714879591571.pngRitaf1983_1-1714879636567.pngRitaf1983_2-1714879715103.png

Result :

Ritaf1983_3-1714879809517.pngRitaf1983_4-1714879826406.png

The pbix with my example is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.