Forum Discussion

Ferha_Jafri's avatar
Ferha_Jafri
Frequent Visitor
1 year ago
Solved

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
  • Anonymous's avatar
    Anonymous
    1 year ago

    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.

6 Replies

  • 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-Forum/ba-p/963216

    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/1447523

  • Anonymous's avatar
    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:

    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)
    }
    
    

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

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

    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.

     

    • Ferha_Jafri's avatar
      Ferha_Jafri
      Frequent Visitor

      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.

      Thanks in advance

      Ferha

      • Anonymous's avatar
        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:

        Here is the result after the modification:

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

        Here is the result after the modification:

         

        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.