<?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 Re: calculated column logic is not as expected. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4281512#M169911</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;You can convert this into a Measure and provided the visual where this measure is used doesn't have more than 1 row in the DMT_GTA table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LegendCategory =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( Reporter[Reporter Order] ) = 0, SELECTEDVALUE ( 'DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Import Zone] ),
    SELECTEDVALUE ( Reporter[Reporter Order] ) = 1, SELECTEDVALUE ( 'DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Export Zone] ),
    SELECTEDVALUE ( Reporter[Reporter Order] ) = 2, SELECTEDVALUE ( 'DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Import Zone] ),
    SELECTEDVALUE ( Reporter[Reporter Order] ) = 3, SELECTEDVALUE ( 'DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Export Zone] ),
    "Please select a value"
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Nov 2024 09:59:47 GMT</pubDate>
    <dc:creator>AntrikshSharma</dc:creator>
    <dc:date>2024-11-13T09:59:47Z</dc:date>
    <item>
      <title>calculated column logic is not as expected.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4279122#M169795</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;LegendCategory = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SWITCH&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;TRUE&lt;/SPAN&gt;&lt;SPAN&gt;(),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(Reporter[Reporter Order]) = &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;, 'DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Import Zone],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(Reporter[Reporter Order]) = &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, 'DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Export Zone],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(Reporter[Reporter Order]) = &lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;, 'DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Import Zone],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(Reporter[Reporter Order]) = &lt;/SPAN&gt;&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;SPAN&gt;, 'DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Export Zone],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"Please select a value"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;STRONG&gt;I dragged report order into slicer. If i select 0,1,2 or 3. It's only&amp;nbsp;&amp;nbsp;compute once and remain static.&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 12 Nov 2024 04:59:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4279122#M169795</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-12T04:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: calculated column logic is not as expected.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4279127#M169796</link>
      <description>&lt;P&gt;hi Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;calculated column/table is not supposed to response to the visual behaviors.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is updated only if you refresh it manually.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 05:05:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4279127#M169796</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2024-11-12T05:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: calculated column logic is not as expected.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4279129#M169797</link>
      <description>&lt;P&gt;Is there any alternate solution otherthan calculated measure.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 05:08:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4279129#M169797</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-12T05:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: calculated column logic is not as expected.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4279457#M169813</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What's your expected behavour? If you select a value from&amp;nbsp;&lt;SPAN&gt;Reporter Order from a slicer and you need to make a calculation on a column then you need to provide a calculation like &lt;EM&gt;Sum('&amp;nbsp;'DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Import Zone]')&lt;/EM&gt; not a column,&amp;nbsp; If you need to dynamically select a column based on selection, go for field paramerters:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 08:23:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4279457#M169813</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2024-11-12T08:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: calculated column logic is not as expected.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4280753#M169886</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much&amp;nbsp;Fowmy&amp;nbsp;and FreemanZ&amp;nbsp;for your prompt reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For this problem, I recommend that you create a measure instead of calculating a column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The measures are dynamically changed based on the selection of the slicer, which is more consistent with usage habits. Also, I have made changes to your code as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LegendCategory = 
IF(
    ISFILTERED('Reporter'[Reporter Order]),
    SWITCH(
        TRUE(),
        SELECTEDVALUE(Reporter[Reporter Order]) = 0, SELECTEDVALUE('DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Import Zone]),
        SELECTEDVALUE(Reporter[Reporter Order]) = 1, SELECTEDVALUE('DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Export Zone]),
        SELECTEDVALUE(Reporter[Reporter Order]) = 2, SELECTEDVALUE('DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Import Zone]),
        SELECTEDVALUE(Reporter[Reporter Order]) = 3, SELECTEDVALUE('DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Export Zone])
    ),
    "Please select a value"
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nono Chen&lt;/P&gt;
&lt;P&gt;If this &lt;STRONG&gt;&lt;EM&gt;post&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;helps, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 02:01:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4280753#M169886</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-13T02:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: calculated column logic is not as expected.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4281278#M169902</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you please help to understand the requirement and challenge you are facing with supporting input data and expect out data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A simple table with input data and expect result would help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 07:24:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4281278#M169902</guid>
      <dc:creator>Ankur04</dc:creator>
      <dc:date>2024-11-13T07:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: calculated column logic is not as expected.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4281512#M169911</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;You can convert this into a Measure and provided the visual where this measure is used doesn't have more than 1 row in the DMT_GTA table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LegendCategory =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( Reporter[Reporter Order] ) = 0, SELECTEDVALUE ( 'DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Import Zone] ),
    SELECTEDVALUE ( Reporter[Reporter Order] ) = 1, SELECTEDVALUE ( 'DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Export Zone] ),
    SELECTEDVALUE ( Reporter[Reporter Order] ) = 2, SELECTEDVALUE ( 'DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Import Zone] ),
    SELECTEDVALUE ( Reporter[Reporter Order] ) = 3, SELECTEDVALUE ( 'DMT_GTA W_DMT_GTA_V_GTA_FCST_TON'[Export Zone] ),
    "Please select a value"
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 09:59:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-logic-is-not-as-expected/m-p/4281512#M169911</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2024-11-13T09:59:47Z</dc:date>
    </item>
  </channel>
</rss>

