<?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 Conditional formatting in Deneb in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Conditional-formatting-in-Deneb/m-p/3988894#M53348</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to create a custom made KPI card visual via Deneb (the PBI card visual simply do not give enough benchmark values to compare the main KPI, I find).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do that, I would like to have the KPI displayed as concise as possible. Therefore, I would like to have the visual adapt the formatting of the KPI value to a k (for thousand) or m (for million) suffix i.e. €219,677 displayed as €219k and €1,488,010 as €1.5m.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I seem to have difficulties setting up my condition section accordingly. I am currently having the following Deneb code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "data": {"name": "dataset"},
  "layer": [
    {
      "mark": {
        "type": "text",
        "fontSize": 25,
        "fontWeight": 600,
        "dx": 0,
        "dy": -35,
        "color": "#454545",
        "align": "center"
      },
      "encoding": {
        "text": {
          "field": "Text YTD Sales"
        }
      }
    },
    {
      "mark": {
        "type": "text",
        "fontWeight": 400,
        "size": 30,
        "color": "#454545",
        "align": "center"
      },
      "encoding": {
        "text": {
          "field": "YTD of CY",
          "aggregate": "sum",
          "type": "quantitative",
          "format": {
            "condition": {
              "test": "datum['YTD of CY'] &amp;lt; 100000",
              "value": "#, €",
              "test": "datum['YTD of CY'] &amp;gt;= 100000",
              "value": "#,.k €"
            },
            "value": "#,,.0m €"
          },
          "formatType": "pbiFormat"
        }
      }
    }
  ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, I tried to copy how they did it in the documentation here&amp;nbsp;&lt;A href="https://vega.github.io/vega-lite/docs/condition.html#condition" target="_blank" rel="noopener"&gt;https://vega.github.io/vega-lite/docs/condition.html#condition&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(section &lt;SPAN class=""&gt;"condition"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;{&lt;/SPAN&gt;&lt;SPAN class=""&gt;"test"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;"datum['num_cars'] &amp;lt; 40"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;"value"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;"black"&lt;/SPAN&gt;&lt;SPAN class=""&gt;}&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I also tried this alternative code based on the documentation here&amp;nbsp;&lt;A href="https://vega.github.io/vega-lite/docs/predicate.html" target="_blank" rel="noopener"&gt;https://vega.github.io/vega-lite/docs/predicate.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "data": {"name": "dataset"},
  "layer": [
    {
      "mark": {
        "type": "text",
        "fontSize": 25,
        "fontWeight": 600,
        "dx": 0,
        "dy": -35,
        "color": "#454545",
        "align": "center"
      },
      "encoding": {
        "text": {
          "field": "Text YTD Sales"
        }
      }
    },
    {
      "mark": {
        "type": "text",
        "fontWeight": 400,
        "size": 30,
        "color": "#454545",
        "align": "center"
      },
      "encoding": {
        "text": {
          "field": "YTD of CY",
          "aggregate": "sum",
          "type": "quantitative",
          "format": {
            "condition": {
              "test": {
                "field": "YTD of CY",
                "lt": 100000
              },
              "value": "#, €",
			  "test": {
                "field": "YTD of CY",
                "gte": 100000
              },
              "value": "#,.k €"
            },
            "value": "#,,.0m €"
          },
          "formatType": "pbiFormat"
        }
      }
    }
  ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, this also did not yield any results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ThomasSan_0-1718201948570.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1115582iF41F98EBF8071B4A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ThomasSan_0-1718201948570.png" alt="ThomasSan_0-1718201948570.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do get the correct figure displayed when I leave the conditional formatting away altogether but then I am trying for a Deneb visual as it would give me more freedom to design a KPI card visual on my personal requirements.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone please help enlighten me here? I really do not understand why neither of my attempts to build in conditional formatting actually works. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2024 14:21:23 GMT</pubDate>
    <dc:creator>ThomasSan</dc:creator>
    <dc:date>2024-06-12T14:21:23Z</dc:date>
    <item>
      <title>Conditional formatting in Deneb</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Conditional-formatting-in-Deneb/m-p/3988894#M53348</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to create a custom made KPI card visual via Deneb (the PBI card visual simply do not give enough benchmark values to compare the main KPI, I find).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do that, I would like to have the KPI displayed as concise as possible. Therefore, I would like to have the visual adapt the formatting of the KPI value to a k (for thousand) or m (for million) suffix i.e. €219,677 displayed as €219k and €1,488,010 as €1.5m.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I seem to have difficulties setting up my condition section accordingly. I am currently having the following Deneb code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "data": {"name": "dataset"},
  "layer": [
    {
      "mark": {
        "type": "text",
        "fontSize": 25,
        "fontWeight": 600,
        "dx": 0,
        "dy": -35,
        "color": "#454545",
        "align": "center"
      },
      "encoding": {
        "text": {
          "field": "Text YTD Sales"
        }
      }
    },
    {
      "mark": {
        "type": "text",
        "fontWeight": 400,
        "size": 30,
        "color": "#454545",
        "align": "center"
      },
      "encoding": {
        "text": {
          "field": "YTD of CY",
          "aggregate": "sum",
          "type": "quantitative",
          "format": {
            "condition": {
              "test": "datum['YTD of CY'] &amp;lt; 100000",
              "value": "#, €",
              "test": "datum['YTD of CY'] &amp;gt;= 100000",
              "value": "#,.k €"
            },
            "value": "#,,.0m €"
          },
          "formatType": "pbiFormat"
        }
      }
    }
  ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, I tried to copy how they did it in the documentation here&amp;nbsp;&lt;A href="https://vega.github.io/vega-lite/docs/condition.html#condition" target="_blank" rel="noopener"&gt;https://vega.github.io/vega-lite/docs/condition.html#condition&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(section &lt;SPAN class=""&gt;"condition"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;{&lt;/SPAN&gt;&lt;SPAN class=""&gt;"test"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;"datum['num_cars'] &amp;lt; 40"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;"value"&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;"black"&lt;/SPAN&gt;&lt;SPAN class=""&gt;}&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I also tried this alternative code based on the documentation here&amp;nbsp;&lt;A href="https://vega.github.io/vega-lite/docs/predicate.html" target="_blank" rel="noopener"&gt;https://vega.github.io/vega-lite/docs/predicate.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "data": {"name": "dataset"},
  "layer": [
    {
      "mark": {
        "type": "text",
        "fontSize": 25,
        "fontWeight": 600,
        "dx": 0,
        "dy": -35,
        "color": "#454545",
        "align": "center"
      },
      "encoding": {
        "text": {
          "field": "Text YTD Sales"
        }
      }
    },
    {
      "mark": {
        "type": "text",
        "fontWeight": 400,
        "size": 30,
        "color": "#454545",
        "align": "center"
      },
      "encoding": {
        "text": {
          "field": "YTD of CY",
          "aggregate": "sum",
          "type": "quantitative",
          "format": {
            "condition": {
              "test": {
                "field": "YTD of CY",
                "lt": 100000
              },
              "value": "#, €",
			  "test": {
                "field": "YTD of CY",
                "gte": 100000
              },
              "value": "#,.k €"
            },
            "value": "#,,.0m €"
          },
          "formatType": "pbiFormat"
        }
      }
    }
  ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, this also did not yield any results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ThomasSan_0-1718201948570.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1115582iF41F98EBF8071B4A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ThomasSan_0-1718201948570.png" alt="ThomasSan_0-1718201948570.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do get the correct figure displayed when I leave the conditional formatting away altogether but then I am trying for a Deneb visual as it would give me more freedom to design a KPI card visual on my personal requirements.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone please help enlighten me here? I really do not understand why neither of my attempts to build in conditional formatting actually works. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 14:21:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Conditional-formatting-in-Deneb/m-p/3988894#M53348</guid>
      <dc:creator>ThomasSan</dc:creator>
      <dc:date>2024-06-12T14:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional formatting in Deneb</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Conditional-formatting-in-Deneb/m-p/3989371#M53363</link>
      <description>&lt;P&gt;Not sure if that helps in your scenario but Deneb also supports Power BI formatting&lt;/P&gt;
&lt;P&gt;&lt;A href="https://csalcedodatabi.github.io/posts/pbiformat-function-advanced-options/" target="_blank"&gt;Exploring the Power of the pbiFormat() Function in Deneb | CSalcedoDataBI&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 18:03:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Conditional-formatting-in-Deneb/m-p/3989371#M53363</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-06-12T18:03:52Z</dc:date>
    </item>
  </channel>
</rss>

