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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Tung
Frequent Visitor

How can I get back the conditional statement in instanceKind: powerbi.VisualEnumerationInstanceKinds

Hi everyone, I need your assistance.
I’ve configured a ColorPicker with a condition like this:

 

new formattingSettings.ColorPicker({
    name: dataPoint.name,
    displayName: dataPoint.displayName,
    value: { value: dataPoint.value as string },
    ...(dataPoint.name === 'backgroundColorValue' && {
        instanceKind: powerbi.VisualEnumerationInstanceKinds.ConstantOrRule
    })
})

Tung_0-1743306511660.png

However, I’m unable to retrieve the condition (rule) inside it so I can process the colors for my data. How can I access the condition defined by the user in the Power BI UI and use it to apply colors to my visual?

In the Power BI documentation, for "Table based visuals" it is not possible to do conditional formatting. I am using "dataViewMappings" with the "table" type as follows:

"dataViewMappings": [
{
"table": {
"rows": {
"select": ["..."]
}
}
}
]

 then my visual will not support Conditional Formatting, as mentioned in the Power BI documentation, right?

I hope you share the tutorial so that I can get the formatting condition. or confirm that I am using "dataViewMappings" with "table" type then this functionality will not work.
Thanks!

1 ACCEPTED SOLUTION
v-csrikanth
Community Support
Community Support

Hi @Tung 
According to Power BI documentation, conditional formatting is primarily supported for visuals like tables, matrices, and charts. However, for "table-based visuals" defined using dataViewMappings with the "table" type, conditional formatting is not supported. Reference link.

If you want to enable conditional formatting in your custom visual:

  1. Consider switching from a "table" mapping to a "categorical" mapping (dataViewMappings.categorical). Categorical mappings allow access to individual categories and values, which are compatible with conditional formatting2.
  2. Ensure that your visual's settings include both instanceKind: ConstantOrRule and a proper selector configuration.
  3. Use the dataView.categorical.categories.objects[ ] property to retrieve and apply user-defined conditional formatting rules dynamically.


If the above information helps you, please give us a Kudos and marked the Accept as a solution.
Best Regards,
Community Support Team _ C Srikanth.

 

View solution in original post

4 REPLIES 4
v-csrikanth
Community Support
Community Support

Hi @Tung 
I wanted to follow up since I haven't heard from you in a while. Have you had a chance to try the suggested solutions?
If your issue is resolved, please consider marking the post as solved. However, if you're still facing challenges, feel free to share the details, and we'll be happy to assist you further.
Looking forward to your response!

Best Regards,
Community Support Team _ C Srikanth.

v-csrikanth
Community Support
Community Support

Hi @Tung 
It's been a while since I heard back from you and I wanted to follow up. Have you had a chance to try the solutions that have been offered?
If the issue has been resolved, can you mark the post as resolved? If you're still experiencing challenges, please feel free to let us know and we'll be happy to continue to help!
Looking forward to your reply!

If the above information helps you, please give us a Kudos and marked the Accept as a solution.
Best Regards,
Community Support Team _ C Srikanth.

v-csrikanth
Community Support
Community Support

Hi @Tung 
I wanted to follow up since I haven't heard from you in a while. Have you had a chance to try the suggested solutions?
If your issue is resolved, please consider marking the post as solved. However, if you're still facing challenges, feel free to share the details, and we'll be happy to assist you further.
Looking forward to your response!

If the above information helps you, please give us a Kudos and marked the Accept as a solution.
Best Regards,
Community Support Team _ C Srikanth.



v-csrikanth
Community Support
Community Support

Hi @Tung 
According to Power BI documentation, conditional formatting is primarily supported for visuals like tables, matrices, and charts. However, for "table-based visuals" defined using dataViewMappings with the "table" type, conditional formatting is not supported. Reference link.

If you want to enable conditional formatting in your custom visual:

  1. Consider switching from a "table" mapping to a "categorical" mapping (dataViewMappings.categorical). Categorical mappings allow access to individual categories and values, which are compatible with conditional formatting2.
  2. Ensure that your visual's settings include both instanceKind: ConstantOrRule and a proper selector configuration.
  3. Use the dataView.categorical.categories.objects[ ] property to retrieve and apply user-defined conditional formatting rules dynamically.


If the above information helps you, please give us a Kudos and marked the Accept as a solution.
Best Regards,
Community Support Team _ C Srikanth.

 

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.