<?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: DAX measure to filter a table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2121890#M48639</link>
    <description>&lt;P&gt;It is strongly recommended to make the the permission table has unique user. it is to prevent any unexpected error in the future as well. if you can not change exisitng permission table, it's better to create one and relates it to both sales table and existing table as 1:m (in case you need exisitng permission table in the future)&lt;/P&gt;</description>
    <pubDate>Thu, 07 Oct 2021 14:46:26 GMT</pubDate>
    <dc:creator>colacan</dc:creator>
    <dc:date>2021-10-07T14:46:26Z</dc:date>
    <item>
      <title>DAX measure to filter a table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2121610#M48625</link>
      <description>&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables: a sales table and a table with some data to filter the sales table. This architecture is a must.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The idea is to filter the sales table depending on the filter applied on the permission table, which gets automatically filtered when starting the report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SALES TABLE&lt;/P&gt;&lt;P&gt;# | Price | User | Shop&lt;/P&gt;&lt;P&gt;1 | 10 € | A | Paris&lt;/P&gt;&lt;P&gt;2 | 12 € | A | Bordeaux&lt;/P&gt;&lt;P&gt;3 | 11 € | B | Rome&lt;/P&gt;&lt;P&gt;4 | 10 € | C | Paris&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PERMISSION TABLE&lt;/P&gt;&lt;P&gt;USER | ACCESS | TYPE&lt;/P&gt;&lt;P&gt;A | A | user&lt;/P&gt;&lt;P&gt;B | B | user&lt;/P&gt;&lt;P&gt;C | C | user&lt;/P&gt;&lt;P&gt;C | Paris | shop&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So that user A would see sale n1 and sale n2. User B would see sale n3 and user C would see sale n1, sale n4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The idea is to calculate it dinamically. Thus, I need this to be done on DAX with a measure. I was thinking to calculate an "X" if the user or the shop is found in the permission table, and filter the sales table by "X".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea on how to do this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot use a DAX table due to the fact that it needs an update of the report to get updated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 13:16:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2121610#M48625</guid>
      <dc:creator>mizaskun</dc:creator>
      <dc:date>2021-10-07T13:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure to filter a table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2121822#M48635</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299045" data-lia-user-login="mizaskun" class="lia-mention lia-mention-user"&gt;mizaskun&lt;/a&gt;&amp;nbsp;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume the permission table and sales table is related as 1:m by the User&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I explain based on your table, you may create basic mearues which you need, like sum of price or average price&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sum_Price = sum(Sales[Price])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AVG_Price = average(Sales[Price])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Then, the filtered calculation based on user would be as below;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sum_Price_PerUser = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;IF(HASONEVALUE(Permission[User]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;CALCULATE(&lt;FONT color="#FF0000"&gt;[Sum_Price]&lt;/FONT&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;FILTER(Sales,related(Permission[User]) = SELECTEDVALUE(Permission[User])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;BLANK()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;By simply replacing the basic measure from&amp;nbsp;&lt;FONT color="#FF0000"&gt;[Sum_price]&lt;/FONT&gt; to [AVG_Price] you can get user-filtered average price as below&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Avr_Price_PerUser = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;IF(HASONEVALUE(Permission[User]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;CALCULATE(&lt;FONT color="#FF0000"&gt;[AVG_Price]&lt;/FONT&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;FILTER(Sales,related(Permission[User]) = SELECTEDVALUE(Permission[User])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;BLANK()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;These measure will show blank if there is no specific user selected from Permission table.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Please mark this as solution if this helped.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 07 Oct 2021 14:15:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2121822#M48635</guid>
      <dc:creator>colacan</dc:creator>
      <dc:date>2021-10-07T14:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure to filter a table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2121884#M48638</link>
      <description>&lt;P&gt;The relation is **, many to many. Any other way to achieve this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 14:40:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2121884#M48638</guid>
      <dc:creator>mizaskun</dc:creator>
      <dc:date>2021-10-07T14:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure to filter a table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2121890#M48639</link>
      <description>&lt;P&gt;It is strongly recommended to make the the permission table has unique user. it is to prevent any unexpected error in the future as well. if you can not change exisitng permission table, it's better to create one and relates it to both sales table and existing table as 1:m (in case you need exisitng permission table in the future)&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 14:46:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2121890#M48639</guid>
      <dc:creator>colacan</dc:creator>
      <dc:date>2021-10-07T14:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure to filter a table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2121933#M48640</link>
      <description>&lt;P&gt;How could I do a user to see his sales &amp;amp; the sales of the shops he owns? thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 14:59:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2121933#M48640</guid>
      <dc:creator>mizaskun</dc:creator>
      <dc:date>2021-10-07T14:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure to filter a table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2122236#M48653</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299045" data-lia-user-login="mizaskun" class="lia-mention lia-mention-user"&gt;mizaskun&lt;/a&gt;&amp;nbsp; Hi, based on your sample data (I have to depend on it to answer your question since this is the only source with which I can understand your issue) I can see the shop is in the sales table already. in that can each user can see their number by shop by simply adding Sales[shop] in the visual as below;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 17:27:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2122236#M48653</guid>
      <dc:creator>colacan</dc:creator>
      <dc:date>2021-10-07T17:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure to filter a table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2123397#M48692</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="255602" data-lia-user-login="colacan" class="lia-mention lia-mention-user"&gt;colacan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I finally did it with the following measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Valid = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;min(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; calculate(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;distinctcount(SALES[sn]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;USERELATIONSHIP(SALES[shop], PERMISSION[access])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; +&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; calculate(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;distinctcount(SALES[sn]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;USERELATIONSHIP(SALES[user], PERMISSION[access])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;, 1)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;This makes the rows to be seen get a 1, and the rows with no permission disapear.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 08 Oct 2021 07:05:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-filter-a-table/m-p/2123397#M48692</guid>
      <dc:creator>mizaskun</dc:creator>
      <dc:date>2021-10-08T07:05:57Z</dc:date>
    </item>
  </channel>
</rss>

