<?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: Username() function as a filter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Username-function-as-a-filter/m-p/1590803#M31953</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , you doing all operation with username(), how you want use with column ?&lt;/P&gt;
&lt;P&gt;example like&lt;/P&gt;
&lt;P&gt;// I have not tested this&lt;/P&gt;
&lt;P&gt;Viewing As = VAR _USERNAME =CALCULATE(USERNAME()) RETURN &lt;BR /&gt;maxx(values(Table[User]), &lt;BR /&gt;RIGHT(&lt;BR /&gt;LEFT (&lt;BR /&gt;_USERNAME,&lt;BR /&gt;SEARCH ( "/", _USERNAME, 1, LEN ( _USERNAME ) )&lt;BR /&gt;),&lt;BR /&gt;LEN (&lt;BR /&gt;LEFT (&lt;BR /&gt;_USERNAME,&lt;BR /&gt;SEARCH ( "/", _USERNAME, 1, LEN (_USERNAME ) - 16 )&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;))&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jan 2021 07:37:57 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2021-01-12T07:37:57Z</dc:date>
    <item>
      <title>Username() function as a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Username-function-as-a-filter/m-p/1590709#M31949</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to achieve this function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a user name column, whenever the user logs in to pbi only his name should be filtered and all other things should show up based on his username alone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to achieve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have already created these 2 measures&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Viewing As = VAR _USERNAME =CALCULATE(USERNAME()) RETURN RIGHT(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;LEFT (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;_USERNAME,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SEARCH ( "/", _USERNAME, 1, LEN ( _USERNAME ) ) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;LEN (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;LEFT (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;_USERNAME,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SEARCH ( "/", _USERNAME, 1, LEN (_USERNAME ) - 16 ) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&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;SPAN&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;//abcdefghijklmnop/rajashri.n will be returned as rajashri.nreturns the user name&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AltRLS = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF( selectedvalue(Manager[parent]) = [Viewing As],1,0)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;//returns the value1 or 0 based on the comparison with the viewing as, if rajashri.n = rajashri.n then 1 else 0&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I must be able to create AltRls as a calculated column and add that as a page level filter (1), this is not possible in power bi now&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;username() function cannot be used in power bi calculated columns, what is the work around here.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I am not expecting RLS as a solution here.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;this is the error I am getting when trying to add a calculated column to c&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 07:58:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Username-function-as-a-filter/m-p/1590709#M31949</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-12T07:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Username() function as a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Username-function-as-a-filter/m-p/1590755#M31951</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , both username, and userprincipalname can not be used in the column. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not you can use Functions like Sumx, Countx etc. If needed use values(Table[ID]) // some root level column you can use force this calculation at a lower level.&lt;/P&gt;
&lt;P&gt;Sumx(Values(Table[ID]), &amp;lt;Formula&amp;gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 07:08:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Username-function-as-a-filter/m-p/1590755#M31951</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-01-12T07:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Username() function as a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Username-function-as-a-filter/m-p/1590784#M31952</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;thanks for the response, can you please elaborate on how sumx or countx could be used in my case. I am unable to understand&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 07:22:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Username-function-as-a-filter/m-p/1590784#M31952</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-12T07:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Username() function as a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Username-function-as-a-filter/m-p/1590803#M31953</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt; , you doing all operation with username(), how you want use with column ?&lt;/P&gt;
&lt;P&gt;example like&lt;/P&gt;
&lt;P&gt;// I have not tested this&lt;/P&gt;
&lt;P&gt;Viewing As = VAR _USERNAME =CALCULATE(USERNAME()) RETURN &lt;BR /&gt;maxx(values(Table[User]), &lt;BR /&gt;RIGHT(&lt;BR /&gt;LEFT (&lt;BR /&gt;_USERNAME,&lt;BR /&gt;SEARCH ( "/", _USERNAME, 1, LEN ( _USERNAME ) )&lt;BR /&gt;),&lt;BR /&gt;LEN (&lt;BR /&gt;LEFT (&lt;BR /&gt;_USERNAME,&lt;BR /&gt;SEARCH ( "/", _USERNAME, 1, LEN (_USERNAME ) - 16 )&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;))&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 07:37:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Username-function-as-a-filter/m-p/1590803#M31953</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-01-12T07:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Username() function as a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Username-function-as-a-filter/m-p/1590850#M31955</link>
      <description>&lt;P&gt;I have edited the main message, can you please check and respond accordingly. All tht I am looking for is to be able to check whether the username() returning value and the column value in my table are matching using a calculated column, so that I can add the TRUE value as a page level filter. Hope you got my situation.&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 08:00:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Username-function-as-a-filter/m-p/1590850#M31955</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-12T08:00:48Z</dc:date>
    </item>
  </channel>
</rss>

