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 August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Custom Visual Blank Value in Javascript/Typescript

Hi all,

 

My team is editing the pbiviz file for the "KPI Indicator" custom visual to force the visual to the "None" color it the case the data is BLANK. The issue is described below.

 

gui_v_0-1621275154012.png

 

https://community.powerbi.com/t5/Desktop/KPI-Indicator-color-for-quot-None-quot-value-does-not-work/m-p/246484

 

Our solution was to just update the visual itself in the visual.ts file. The questions we are facing in doing this are the following:

1) How does Power BI pass on a BLANK() value in DAX to the visual? We believe it is the `kpiActual` variable but not sure.

2) How does one evaluate that variable, whatever it is, in javascript? 

 

We've tried: 

- if (....kpiActual == null) then {....do the coloring.....}

- if (....kpiActual == "undefined" then {....do the coloring...}

- Setting: diffText = "(" + GetKPIActualDiffFromGoal(kpiActual, kpiGoal, this.kpiCurrentSettings.kpi.bandingCompareType, this.kpiCurrentSettings.kpi.indicateDifferenceAsPercent) + ")"

      - if (.... diffText != "(Blank)") then {.... do the coloring...}

 

None of these seem to work! Don't know much Javascript but it is absolutely essential for us to be able to set the color to gray in the case that the KPI Actual Value evaluates to BLANK()

 

 

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @Anonymous,

If you're attempting to modify a visual that is already published in AppSource, Power BI will always look it up and load it from there, based on its guid. I suggest you try switching on developer mode in Desktop to test the packaged visual, otherwise you'll never see the results of your changes if loading from a .pbiviz.

If this works, you'll then need to change the visual's guid in pbiviz.json to something else, so that it doesn't match the one in AppSource. This way, Power BI Desktop will treat your visual as a separate one and load it.

Bear in mind that because you're doing this, it will no longer treat the visual as certified because it no longer matches AppSource, so if you need these changes incorporating then I'd suggest contacting the developer of the visual to see if they can assist with this or accept your changes.

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@dm-p , your response was helpful. We were able to successfully modify the KPI Indicator visual by going to developer mode in the PBI Online Service. Changing the GUID was crucial for it to render. Thanks.

dm-p
Super User
Super User

Hi @Anonymous,

If you're attempting to modify a visual that is already published in AppSource, Power BI will always look it up and load it from there, based on its guid. I suggest you try switching on developer mode in Desktop to test the packaged visual, otherwise you'll never see the results of your changes if loading from a .pbiviz.

If this works, you'll then need to change the visual's guid in pbiviz.json to something else, so that it doesn't match the one in AppSource. This way, Power BI Desktop will treat your visual as a separate one and load it.

Bear in mind that because you're doing this, it will no longer treat the visual as certified because it no longer matches AppSource, so if you need these changes incorporating then I'd suggest contacting the developer of the visual to see if they can assist with this or accept your changes.

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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