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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Ferha_Jafri
Frequent Visitor

Gradient colors are not coming for DAX expresions using toggle

Hello Experts,

 

I have DAX expresions mentioned below which I am managing through slicer, 

Prem_Cla_Inc toggle =
 var selected_toggle = SELECTEDVALUE(View[Value])
 var var_value = SWITCH(TRUE(),
selected_toggle = "Total Premium",[Sum_Premium],
selected_toggle = "Total Incurred",[Sum_Incured],
selected_toggle = "No. of Claims",[# Claims]
)
 RETURN var_value
The issue is that I want to use gradient color depending on the selection made on the toggle. As for Premium , Incurred and No. of Claims. Which I am not sure how can be done.
 
Thanks in advance
Ferha
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Ferha_Jafri 

 

At present, the only solution I can think of is to manually modify each column individually.

 

If you have any new ideas, we would be delighted to hear from you. 

 

Best Regards,

Leroy Lu

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

6 REPLIES 6
Anonymous
Not applicable

Thanks for the reply from lbendlin , please allow me to provide another insight:

Hi, @Ferha_Jafri 

Regarding the issue you raised, my solution is as follows:

1.Firstly, you need to select the desired measure as a parameter, as shown in the image below:

vlinyulumsft_0-1727058130037.png

vlinyulumsft_1-1727058130038.png

2.Secondly, rename the parameter appropriately and use it as part of the slicer and the visualisation

Parameter = {
    ("Total Premium", NAMEOF('Table'[Sum_Premium]), 0),
    ("Total Incurred", NAMEOF('Table'[Sum_Incured]), 1),
    ("No. of Claims", NAMEOF('Table'[# Claims]), 2)
}

vlinyulumsft_2-1727058187918.png

vlinyulumsft_3-1727058187919.png

3.Next, without selecting the slicer, modify the background colour for each column:

vlinyulumsft_4-1727058201202.png

vlinyulumsft_5-1727058201203.png

vlinyulumsft_6-1727058217547.png

4.Here is the final result, which I hope meets your requirements:

vlinyulumsft_7-1727058217547.png

vlinyulumsft_8-1727058245836.png

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

 

Thanks for your reply, it is very helpfull. The issue which I am facing is that I have to get the gradient colors on the basis of the parameter selection in a bar chart. I am not be able attch the pbix file with the bar chart a,how can attach it as I am on office laptop and will not access any external drive. Please let me know how to do it. In your pbix I need like below.

Ferha_Jafri_0-1727066453508.png

Thanks in advance

Ferha

Anonymous
Not applicable

Hi, @Ferha_Jafri 

I have found two methods for you:

 

1.Firstly, in the background colour settings, change the style to “rules” and modify it as shown in the image below:

vlinyulumsft_0-1727075952779.png

Here is the result after the modification:

vlinyulumsft_1-1727075952781.png

2.Secondly, keep the style as “gradient” and add an intermediate value, as shown in the image below:

vlinyulumsft_2-1727075982599.png

Here is the result after the modification:

vlinyulumsft_3-1727075982600.png

 

For questions about uploading data, you can try the following links:

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Solved: How to upload PBI in Community - Microsoft Fabric Community

When uploading a file, please be careful to delete sensitive information.

 

Best Regards,

Leroy Lu

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

 

Thanks for your reply, the above solution which you provided is for # Claims, but what will happen when from Parameter list we will select "Total Premium" or "Total Incurred". The issue is as I mentioned in my previous reply as when we select "Total Premium" or "Total Incurred" or "No. of Claims" then the color variation should happen on the basis of sum_Premium, sum_Incurred, # Claims.

Anonymous
Not applicable

Hi, @Ferha_Jafri 

 

At present, the only solution I can think of is to manually modify each column individually.

 

If you have any new ideas, we would be delighted to hear from you. 

 

Best Regards,

Leroy Lu

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

lbendlin
Super User
Super User

Your requirement is not clear to me.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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