<?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: Filter an entire table based on What If Parameter and Logged In User Name in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-an-entire-table-based-on-What-If-Parameter-and-Logged-In/m-p/734449#M1933</link>
    <description>&lt;PRE&gt;Project Visible :=
var __selection = SELECTEDVALUE( Projects[Project Value] )
var __currentUser = USERNAME()
var __oneProjectVisible = HASONEVALUE( TheProjects[Project_ID] )
-- ManagerUserName must be in the format of __currentUser
var __currentProjManager = VALUES( TheProjects[ManagerUserName] )
return
	if( __oneProjectVisible,
			
		if(
			__selection = 1, -- my proj only
			__currentProjManager = __currentUser,
			TRUE() -- show all rows
		),
		
		-- don't show anything if many projects
		-- are visible in the current context.
		FALSE()
	)

-- The table with projects, TheProjects, must
-- have a column that stores your managers'
-- domain-name\user-name identifiers.
-- You can filter your table in a visual using
-- the above measure. If TRUE(), show the row,
-- if FALSE() hide.&lt;/PRE&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jul 2019 18:23:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-07-08T18:23:37Z</dc:date>
    <item>
      <title>Filter an entire table based on What If Parameter and Logged In User Name</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-an-entire-table-based-on-What-If-Parameter-and-Logged-In/m-p/734294#M1916</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to filter the data based on logged in user and a cutom filter(slicer) which I created using What If Parameter of type Whole Number. I used below DAX to convert Whole Number Parameter to a string type slicer ( for end users)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Projects = SWITCH(TRUE(), Projects[Projects Value] = 1, "My Projects Only", Projects[Projects Value] = 2, "All Projects")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Now, I want to use this slicer to filter the data from Project table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If User selects 'My Projects Only', It should display Projects where 'PROJECT_MANAGER = Logged in User' , otherwise it should display all rows.&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 on how to achieve this in Power BI/DAX are much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mohit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 14:50:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-an-entire-table-based-on-What-If-Parameter-and-Logged-In/m-p/734294#M1916</guid>
      <dc:creator>MohitPowerBI</dc:creator>
      <dc:date>2019-07-08T14:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Filter an entire table based on What If Parameter and Logged In User Name</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-an-entire-table-based-on-What-If-Parameter-and-Logged-In/m-p/734449#M1933</link>
      <description>&lt;PRE&gt;Project Visible :=
var __selection = SELECTEDVALUE( Projects[Project Value] )
var __currentUser = USERNAME()
var __oneProjectVisible = HASONEVALUE( TheProjects[Project_ID] )
-- ManagerUserName must be in the format of __currentUser
var __currentProjManager = VALUES( TheProjects[ManagerUserName] )
return
	if( __oneProjectVisible,
			
		if(
			__selection = 1, -- my proj only
			__currentProjManager = __currentUser,
			TRUE() -- show all rows
		),
		
		-- don't show anything if many projects
		-- are visible in the current context.
		FALSE()
	)

-- The table with projects, TheProjects, must
-- have a column that stores your managers'
-- domain-name\user-name identifiers.
-- You can filter your table in a visual using
-- the above measure. If TRUE(), show the row,
-- if FALSE() hide.&lt;/PRE&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 18:23:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-an-entire-table-based-on-What-If-Parameter-and-Logged-In/m-p/734449#M1933</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-08T18:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Filter an entire table based on What If Parameter and Logged In User Name</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-an-entire-table-based-on-What-If-Parameter-and-Logged-In/m-p/735769#M2024</link>
      <description>&lt;P&gt;Thank you Darek, it worked like a charm :)&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 20:59:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-an-entire-table-based-on-What-If-Parameter-and-Logged-In/m-p/735769#M2024</guid>
      <dc:creator>MohitPowerBI</dc:creator>
      <dc:date>2019-07-09T20:59:08Z</dc:date>
    </item>
  </channel>
</rss>

