<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic dynamic conditional formatting with virtual table and switch in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/dynamic-conditional-formatting-with-virtual-table-and-switch/m-p/3225500#M7430</link>
    <description>&lt;P&gt;Hi, im having an issue building dynamic conditional formatting on my visual (color columns)&lt;/P&gt;&lt;P&gt;The reason why i need to build that are all spaces in between columns in a chart, if more trafo numbers are selected than the spaces gets bigger&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattReckoner_3-1683569295156.jpeg" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/911861i02B3B69CCD84F741/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MattReckoner_3-1683569295156.jpeg" alt="MattReckoner_3-1683569295156.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To do that i added a table with ColorID and HEX rgb.&lt;/P&gt;&lt;P&gt;I want to build virtual table with all selected Serial Numbers from slicer, adding&amp;nbsp;HEX rgb by matchin the ID from virtual table and colorID&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then with switch return HEX rgb. The problem i have is that it always return same hex rgb with index nr 1&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattReckoner_4-1683570594731.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/911868iBBFA9AC7D728A9D3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MattReckoner_4-1683570594731.png" alt="MattReckoner_4-1683570594731.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IndexColorTrafo =&lt;/P&gt;&lt;P&gt;var&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;CurrentSelection=MAX(MeasurementsByFrequency[Serial Number])&lt;/P&gt;&lt;P&gt;VAR&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SelectedTrafoIDs =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;VALUES(MeasurementsByFrequency[Serial Number])&lt;/P&gt;&lt;P&gt;VAR&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;NumSelectedTrafoIDs =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;COUNTROWS(SelectedTrafoIDs)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;VirtualTable =&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ADDCOLUMNS(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;GENERATESERIES(1, NumSelectedTrafoIDs),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;"TrafoID",&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SELECTEDVALUE(MeasurementsByFrequency[Serial Number]),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;"ColorID",&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;LOOKUPVALUE(TblCSSColor[Hex rgb],TblCSSColor[ColorID],[Value])&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp;VAR&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Output=&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;MAXX(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VirtualTable,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;//VAR CurrentTrafoID = [TrafoID]&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;//RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;IF(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NumSelectedTrafoIDs =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;0,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;BLANK(),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SWITCH(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;TRUE(),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;//[TrafoID]=CurrentSelection,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;CONTAINSSTRING(SelectedTrafoIDs, CurrentSelection),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [ColorID],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;BLANK()&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;Return&lt;/P&gt;&lt;P&gt;Output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;anyone can help?&lt;/P&gt;</description>
    <pubDate>Mon, 08 May 2023 18:31:05 GMT</pubDate>
    <dc:creator>MattReckoner</dc:creator>
    <dc:date>2023-05-08T18:31:05Z</dc:date>
    <item>
      <title>dynamic conditional formatting with virtual table and switch</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/dynamic-conditional-formatting-with-virtual-table-and-switch/m-p/3225500#M7430</link>
      <description>&lt;P&gt;Hi, im having an issue building dynamic conditional formatting on my visual (color columns)&lt;/P&gt;&lt;P&gt;The reason why i need to build that are all spaces in between columns in a chart, if more trafo numbers are selected than the spaces gets bigger&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattReckoner_3-1683569295156.jpeg" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/911861i02B3B69CCD84F741/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MattReckoner_3-1683569295156.jpeg" alt="MattReckoner_3-1683569295156.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To do that i added a table with ColorID and HEX rgb.&lt;/P&gt;&lt;P&gt;I want to build virtual table with all selected Serial Numbers from slicer, adding&amp;nbsp;HEX rgb by matchin the ID from virtual table and colorID&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then with switch return HEX rgb. The problem i have is that it always return same hex rgb with index nr 1&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattReckoner_4-1683570594731.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/911868iBBFA9AC7D728A9D3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MattReckoner_4-1683570594731.png" alt="MattReckoner_4-1683570594731.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IndexColorTrafo =&lt;/P&gt;&lt;P&gt;var&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;CurrentSelection=MAX(MeasurementsByFrequency[Serial Number])&lt;/P&gt;&lt;P&gt;VAR&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SelectedTrafoIDs =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;VALUES(MeasurementsByFrequency[Serial Number])&lt;/P&gt;&lt;P&gt;VAR&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;NumSelectedTrafoIDs =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;COUNTROWS(SelectedTrafoIDs)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;VirtualTable =&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ADDCOLUMNS(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;GENERATESERIES(1, NumSelectedTrafoIDs),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;"TrafoID",&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SELECTEDVALUE(MeasurementsByFrequency[Serial Number]),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;"ColorID",&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;LOOKUPVALUE(TblCSSColor[Hex rgb],TblCSSColor[ColorID],[Value])&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp;VAR&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Output=&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;MAXX(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VirtualTable,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;//VAR CurrentTrafoID = [TrafoID]&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;//RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;IF(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NumSelectedTrafoIDs =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;0,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;BLANK(),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SWITCH(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;TRUE(),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;//[TrafoID]=CurrentSelection,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;CONTAINSSTRING(SelectedTrafoIDs, CurrentSelection),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [ColorID],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;BLANK()&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;Return&lt;/P&gt;&lt;P&gt;Output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;anyone can help?&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2023 18:31:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/dynamic-conditional-formatting-with-virtual-table-and-switch/m-p/3225500#M7430</guid>
      <dc:creator>MattReckoner</dc:creator>
      <dc:date>2023-05-08T18:31:05Z</dc:date>
    </item>
  </channel>
</rss>

