<?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: in a table creat a measure base on two column values in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3011714#M102133</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="440504" data-lia-user-login="reynold522" class="lia-mention lia-mention-user"&gt;reynold522&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is always the best to raise a question, discuss with someone, then realize the solution by oneself.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2023 16:10:34 GMT</pubDate>
    <dc:creator>FreemanZ</dc:creator>
    <dc:date>2023-01-10T16:10:34Z</dc:date>
    <item>
      <title>in a table creat a measure base on two column values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3010988#M102075</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp; would like to creat a&amp;nbsp; measure base on condition of two table column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if column: BAT_TYPE is A, and column:&amp;nbsp;CAPACITY_AH is 210, then value should be 168&lt;/P&gt;&lt;P&gt;if column: BAT_TYPE is A, and column:&amp;nbsp;CAPACITY_AH is 100, then value should be 80&lt;/P&gt;&lt;P&gt;if column: BAT_TYPE is E, and column:&amp;nbsp;CAPACITY_AH is 240, then value should be 120&lt;/P&gt;&lt;P&gt;if column: BAT_TYPE is S, and column:&amp;n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lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"E"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&amp;amp;Table&lt;/SPAN&gt;&lt;SPAN&gt;[CAPACITY_AH]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;240&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;120&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Table[BAT_TYPE]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"S"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&amp;amp;Table&lt;/SPAN&gt;&lt;SPAN&gt;[CAPACITY_AH]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;225&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;45&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;BLANK&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;I got following error meesage:&lt;/P&gt;&lt;P&gt;A single value for column 'BAT_TYPE' in table 'Table' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 11:00:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3010988#M102075</guid>
      <dc:creator>reynold522</dc:creator>
      <dc:date>2023-01-10T11:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: in a table creat a measure base on two column values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3010999#M102076</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="440504" data-lia-user-login="reynold522" class="lia-mention lia-mention-user"&gt;reynold522&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could use below code if you are using these columns on the visual:-&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Capacitythreshold =
SWITCH (
    TRUE (),
    MAX ( Table[BAT_TYPE] ) = "A"
        &amp;amp;&amp;amp; MAX ( Table[CAPACITY_AH] ) = 210, 168,
    MAX ( Table[BAT_TYPE] ) = "A"
        &amp;amp;&amp;amp; MAX ( Table[CAPACITY_AH] ) = 100, 80,
    MAX ( Table[BAT_TYPE] ) = "E"
        &amp;amp;&amp;amp; MAX ( Table[CAPACITY_AH] ) = 240, 120,
    MAX ( Table[BAT_TYPE] ) = "S"
        &amp;amp;&amp;amp; MAX ( Table[CAPACITY_AH] ) = 225, 45,
    BLANK ()
)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 10 Jan 2023 11:03:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3010999#M102076</guid>
      <dc:creator>Samarth_18</dc:creator>
      <dc:date>2023-01-10T11:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: in a table creat a measure base on two column values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3011143#M102080</link>
      <description>&lt;P&gt;sorry it is grammatically correct however, not able to generate the result I need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still thanks&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 12:30:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3011143#M102080</guid>
      <dc:creator>reynold522</dc:creator>
      <dc:date>2023-01-10T12:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: in a table creat a measure base on two column values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3011434#M102106</link>
      <description>&lt;P&gt;Can you share the sample data(raw not screenshot) with expected output pls?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 14:47:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3011434#M102106</guid>
      <dc:creator>Samarth_18</dc:creator>
      <dc:date>2023-01-10T14:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: in a table creat a measure base on two column values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3011687#M102126</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="440504" data-lia-user-login="reynold522" class="lia-mention lia-mention-user"&gt;reynold522&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A measure depends heavely on the filter context. Without knowing the filter context, there is always issue.&lt;/P&gt;&lt;P&gt;Why don't create a calculated column with the same code and plot a visual with that column?&lt;/P&gt;&lt;P&gt;Actually the way you use SWITCH is the typical way of using SWTCH for calculated columns.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:03:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3011687#M102126</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-01-10T16:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: in a table creat a measure base on two column values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3011699#M102129</link>
      <description>&lt;P&gt;thanks, actually I made it before your answer.&lt;BR /&gt;&lt;BR /&gt;Anyway, thanks! I accept your solution as answer.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:06:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3011699#M102129</guid>
      <dc:creator>reynold522</dc:creator>
      <dc:date>2023-01-10T16:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: in a table creat a measure base on two column values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3011714#M102133</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="440504" data-lia-user-login="reynold522" class="lia-mention lia-mention-user"&gt;reynold522&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is always the best to raise a question, discuss with someone, then realize the solution by oneself.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:10:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/in-a-table-creat-a-measure-base-on-two-column-values/m-p/3011714#M102133</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-01-10T16:10:34Z</dc:date>
    </item>
  </channel>
</rss>

