<?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: How to add a column based on a particular value on another column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/767665#M3522</link>
    <description>&lt;P&gt;This is the correct code. Your code should be avoided because it's using CALCULATE in a calculated column and this - as is known - generates a lot of context transitions that slow down the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[Final Result] = -- calculated column
var __object = T1[Object]
var __hasBeenApproved =
	NOT ISEMPTY(
		FILTER (
			T1,
			T1[Object] = __object
			&amp;amp;&amp;amp;
			T1[Result] = "approved"
		)
	)
retun
	if(
		__hasBeenApproved,
		"Approved",
		"Rejected"
	)&lt;/PRE&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;Darek&lt;/P&gt;</description>
    <pubDate>Thu, 15 Aug 2019 14:44:45 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-08-15T14:44:45Z</dc:date>
    <item>
      <title>How to add a column based on a particular value on another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/767563#M3515</link>
      <description>&lt;P&gt;Ok, here is the problem, I think this is easy but just didn't figure out the solution by myself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables, which are related by Object. My problem is TABLE 1.&lt;/P&gt;&lt;P&gt;In TABLE 1 the Object can get four kind of status:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Applied&lt;/P&gt;&lt;P&gt;2. Viewed&lt;/P&gt;&lt;P&gt;3. Approved &lt;STRONG&gt;OR&lt;/STRONG&gt; Rejected&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to add a column to TABLE 1 (green RESULT column below) which gives the number 3. result for all rows within the same Object. So when I select an object in visualization, it gives me immediately the information if the Object is Approved or Rejected. I could also use that as a filter to search rejected objects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Any ideas? Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Theiren&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 13:04:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/767563#M3515</guid>
      <dc:creator>Theiren</dc:creator>
      <dc:date>2019-08-15T13:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a column based on a particular value on another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/767585#M3517</link>
      <description>&lt;PRE&gt;[Final Result] = -- calculated column
var __object = T1[Object]
var __hasBeenApproved =
	NOT ISEMPTY(
		T,
		T1[Object] = __object
		&amp;amp;&amp;amp;
		T1[Result] = "approved"
	)
retun
	if(
		__hasBeenApproved,
		"Approved",
		"Rejected"
	)&lt;/PRE&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;D.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 13:23:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/767585#M3517</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-15T13:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a column based on a particular value on another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/767608#M3519</link>
      <description>&lt;P&gt;Thank you for your swift reply&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;! Function ISEMPTY seems to take only "Table" as a parameter, is there a typo in your dax?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Theiren&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 13:37:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/767608#M3519</guid>
      <dc:creator>Theiren</dc:creator>
      <dc:date>2019-08-15T13:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a column based on a particular value on another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/767651#M3521</link>
      <description>&lt;P&gt;I created the following DAX:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ResultColumn = 
var approved =
    CALCULATE(COUNTROWS(TABLE1),
    FILTER(TABLE1, EARLIER(TABLE1[OBJECT]) = TABLE1[OBJECT] &amp;amp;&amp;amp; TABLE1[STAT] = "I6789"))
return
    IF(approved &amp;gt; 0, "Approved", "Rejected")&lt;/PRE&gt;&lt;P&gt;This gives me the result I was hoping to get. BUT, I am still wondering how to create a slicer of this (i.e. if I want to see only rejected objects). Anyway, I will close this thread now and maybe return the second issue later if needed.&lt;BR /&gt;&lt;BR /&gt;/Theiren&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 14:21:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/767651#M3521</guid>
      <dc:creator>Theiren</dc:creator>
      <dc:date>2019-08-15T14:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a column based on a particular value on another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/767665#M3522</link>
      <description>&lt;P&gt;This is the correct code. Your code should be avoided because it's using CALCULATE in a calculated column and this - as is known - generates a lot of context transitions that slow down the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[Final Result] = -- calculated column
var __object = T1[Object]
var __hasBeenApproved =
	NOT ISEMPTY(
		FILTER (
			T1,
			T1[Object] = __object
			&amp;amp;&amp;amp;
			T1[Result] = "approved"
		)
	)
retun
	if(
		__hasBeenApproved,
		"Approved",
		"Rejected"
	)&lt;/PRE&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 14:44:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/767665#M3522</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-15T14:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a column based on a particular value on another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/767678#M3525</link>
      <description>How to see only the rejected objects? That's simple when you have the column. You just put it in a slicer.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;Darek</description>
      <pubDate>Thu, 15 Aug 2019 14:46:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/767678#M3525</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-15T14:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a column based on a particular value on another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/768604#M3558</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;!!! It works now and I marked your reply as a solution. I am not prof enough to understand which actions slow down the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also solved the slicer problem. For some reason if I used this new column as a slicer, it didn't work how I wanted (with info from other table), but when I brought the result to another table (where is only one object per row) it started to work. Thank you anyway! :-)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Theiren&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 13:25:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/768604#M3558</guid>
      <dc:creator>Theiren</dc:creator>
      <dc:date>2019-08-16T13:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a column based on a particular value on another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/768655#M3560</link>
      <description>Glad it has worked.&lt;BR /&gt;&lt;BR /&gt;__DAX is simple but is NOT easy__. There are many caveats and intricacies that will put people in difficult and hard-to-understand situations very often (unless they know exactly how DAX works) but there's always, ALWAYS, a logical explanation of what you see and it follows the rules to the very last letter.&lt;BR /&gt;&lt;BR /&gt;Be prepared for that but do not get discouraged :) There's always a way to get what you want.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;Darek</description>
      <pubDate>Fri, 16 Aug 2019 14:03:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-a-column-based-on-a-particular-value-on-another/m-p/768655#M3560</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-16T14:03:25Z</dc:date>
    </item>
  </channel>
</rss>

