<?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: Need help with RLS in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-RLS/m-p/4283107#M169992</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="847491" data-lia-user-login="hichamou" class="lia-mention lia-mention-user"&gt;hichamou&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To create a card that shows the &lt;STRONG&gt;SS&lt;/STRONG&gt; for users with the role "ALL" and the &lt;STRONG&gt;Last4&lt;/STRONG&gt; for users with the role "Station", you can achieve this by creating a measure that uses conditional logic based on the user’s role.&lt;/P&gt;&lt;P&gt;Here’s how you can set it up in DAX, assuming you have relationships between the tables or have set up a way to identify the logged-in user:&lt;/P&gt;&lt;H3&gt;Step 1: Create a Measure for Conditional Display&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Identify User Role&lt;/STRONG&gt;: If you can identify the logged-in user, use their role from the &lt;STRONG&gt;Users Table&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Create Conditional Measure&lt;/STRONG&gt;: Use SWITCH or IF to conditionally display &lt;STRONG&gt;SS&lt;/STRONG&gt; or &lt;STRONG&gt;Last4&lt;/STRONG&gt; based on the role.&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;DAX Measure&lt;/H3&gt;&lt;P&gt;Assuming:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;DataTable&lt;/STRONG&gt; is your main table with columns SS and Last4.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Users Table&lt;/STRONG&gt; contains User and Role.&lt;/LI&gt;&lt;LI&gt;You can identify the current user with a function like USERNAME() or via another filter.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here’s a sample DAX formula:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DisplayValue = 
VAR CurrentUser = SELECTEDVALUE('Users Table'[User])
VAR UserRole = LOOKUPVALUE('Users Table'[Role], 'Users Table'[User], CurrentUser)

RETURN
    SWITCH(
        TRUE(),
        UserRole = "ALL", MAX('DataTable'[SS]),
        UserRole = "Station", MAX('DataTable'[Last4]),
        BLANK()
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;Explanation&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;CurrentUser&lt;/STRONG&gt;: Retrieves the currently logged-in user.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;UserRole&lt;/STRONG&gt;: Uses LOOKUPVALUE to find the role of the current user in the &lt;STRONG&gt;Users Table&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;SWITCH&lt;/STRONG&gt;:&lt;UL&gt;&lt;LI&gt;If the role is "ALL", it returns the SS value.&lt;/LI&gt;&lt;LI&gt;If the role is "Station", it returns the Last4 value.&lt;/LI&gt;&lt;LI&gt;If the role is neither, it returns blank.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;Step 2: Add the Measure to a Card Visual&lt;/H3&gt;&lt;P&gt;Add the DisplayValue measure to a card visual. Based on the role of the logged-in user, the card will display either the SS or Last4 value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This setup should dynamically adjust based on the role associated with the user viewing the report. Let me know if you need further assistance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution, this will help others!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If my response(s) assisted you in any way, don't forget to drop me a "&lt;STRONG&gt;Kudos&lt;/STRONG&gt;" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Poojara&lt;BR /&gt;Data Analyst | MSBI Developer | Power BI Consultant&lt;BR /&gt;&lt;STRONG&gt;YouTube&lt;/STRONG&gt;: &lt;A href="https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS" target="_blank" rel="noopener"&gt;https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Nov 2024 05:59:05 GMT</pubDate>
    <dc:creator>Poojara_D12</dc:creator>
    <dc:date>2024-11-14T05:59:05Z</dc:date>
    <item>
      <title>Need help with RLS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-RLS/m-p/4282711#M169972</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following data table&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Name&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;SS&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Last4&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;kiki&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;111111111&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1111&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;sisi&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;222222222&lt;/P&gt;&lt;/TD&gt;&lt;T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gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I need to show a card with SS to all the Roles ALL and show Last4 to the role Station.&lt;/P&gt;&lt;P&gt;Can you help me with that?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 01:11:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-RLS/m-p/4282711#M169972</guid>
      <dc:creator>hichamou</dc:creator>
      <dc:date>2024-11-14T01:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RLS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-RLS/m-p/4283107#M169992</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="847491" data-lia-user-login="hichamou" class="lia-mention lia-mention-user"&gt;hichamou&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To create a card that shows the &lt;STRONG&gt;SS&lt;/STRONG&gt; for users with the role "ALL" and the &lt;STRONG&gt;Last4&lt;/STRONG&gt; for users with the role "Station", you can achieve this by creating a measure that uses conditional logic based on the user’s role.&lt;/P&gt;&lt;P&gt;Here’s how you can set it up in DAX, assuming you have relationships between the tables or have set up a way to identify the logged-in user:&lt;/P&gt;&lt;H3&gt;Step 1: Create a Measure for Conditional Display&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Identify User Role&lt;/STRONG&gt;: If you can identify the logged-in user, use their role from the &lt;STRONG&gt;Users Table&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Create Conditional Measure&lt;/STRONG&gt;: Use SWITCH or IF to conditionally display &lt;STRONG&gt;SS&lt;/STRONG&gt; or &lt;STRONG&gt;Last4&lt;/STRONG&gt; based on the role.&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;DAX Measure&lt;/H3&gt;&lt;P&gt;Assuming:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;DataTable&lt;/STRONG&gt; is your main table with columns SS and Last4.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Users Table&lt;/STRONG&gt; contains User and Role.&lt;/LI&gt;&lt;LI&gt;You can identify the current user with a function like USERNAME() or via another filter.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here’s a sample DAX formula:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DisplayValue = 
VAR CurrentUser = SELECTEDVALUE('Users Table'[User])
VAR UserRole = LOOKUPVALUE('Users Table'[Role], 'Users Table'[User], CurrentUser)

RETURN
    SWITCH(
        TRUE(),
        UserRole = "ALL", MAX('DataTable'[SS]),
        UserRole = "Station", MAX('DataTable'[Last4]),
        BLANK()
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;Explanation&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;CurrentUser&lt;/STRONG&gt;: Retrieves the currently logged-in user.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;UserRole&lt;/STRONG&gt;: Uses LOOKUPVALUE to find the role of the current user in the &lt;STRONG&gt;Users Table&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;SWITCH&lt;/STRONG&gt;:&lt;UL&gt;&lt;LI&gt;If the role is "ALL", it returns the SS value.&lt;/LI&gt;&lt;LI&gt;If the role is "Station", it returns the Last4 value.&lt;/LI&gt;&lt;LI&gt;If the role is neither, it returns blank.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;Step 2: Add the Measure to a Card Visual&lt;/H3&gt;&lt;P&gt;Add the DisplayValue measure to a card visual. Based on the role of the logged-in user, the card will display either the SS or Last4 value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This setup should dynamically adjust based on the role associated with the user viewing the report. Let me know if you need further assistance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution, this will help others!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If my response(s) assisted you in any way, don't forget to drop me a "&lt;STRONG&gt;Kudos&lt;/STRONG&gt;" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Poojara&lt;BR /&gt;Data Analyst | MSBI Developer | Power BI Consultant&lt;BR /&gt;&lt;STRONG&gt;YouTube&lt;/STRONG&gt;: &lt;A href="https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS" target="_blank" rel="noopener"&gt;https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 05:59:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-RLS/m-p/4283107#M169992</guid>
      <dc:creator>Poojara_D12</dc:creator>
      <dc:date>2024-11-14T05:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RLS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-RLS/m-p/4283115#M169993</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="847491" data-lia-user-login="hichamou" class="lia-mention lia-mention-user"&gt;hichamou&lt;/a&gt;&amp;nbsp;Try using below steps&lt;/P&gt;
&lt;P&gt;Ensure there is a relationship between the tables if necessary.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create Measures: Create measures to display the SS or Last4 based on the user's role.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use DAX for Conditional Display: Use DAX (Data Analysis Expressions) to create measures that conditionally display the SS or Last4 based on the role.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example of how you can create these measures:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;SS_Display = &lt;BR /&gt;IF(&lt;BR /&gt;SELECTEDVALUE(Users[Role]) = "ALL",&lt;BR /&gt;SELECTEDVALUE(DataTable[SS]),&lt;BR /&gt;BLANK()&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Last4_Display = &lt;BR /&gt;IF(&lt;BR /&gt;SELECTEDVALUE(Users[Role]) = "Station",&lt;BR /&gt;SELECTEDVALUE(DataTable[Last4]),&lt;BR /&gt;BLANK()&lt;BR /&gt;)&lt;BR /&gt;Create Cards: Add two card visuals to your report.&lt;/P&gt;
&lt;P&gt;Set the Measures: Set the first card to display the SS_Display measure and the second card to display the Last4_Display measure.&lt;/P&gt;
&lt;P&gt;Filter the Cards: Ensure that the cards are filtered by the appropriate user role. You can use slicers or filters to control which user role is currently active.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 06:01:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-RLS/m-p/4283115#M169993</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2024-11-14T06:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RLS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-RLS/m-p/4284691#M170059</link>
      <description>&lt;P&gt;It worked, Thanks Poojara.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 21:27:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-RLS/m-p/4284691#M170059</guid>
      <dc:creator>hichamou</dc:creator>
      <dc:date>2024-11-14T21:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RLS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-RLS/m-p/4285148#M170084</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="847491" data-lia-user-login="hichamou" class="lia-mention lia-mention-user"&gt;hichamou&lt;/a&gt;&amp;nbsp; Glad to hear that!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 04:29:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-RLS/m-p/4285148#M170084</guid>
      <dc:creator>Poojara_D12</dc:creator>
      <dc:date>2024-11-15T04:29:51Z</dc:date>
    </item>
  </channel>
</rss>

