<?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 Filtering Data using MID and SWITCH functions to apply RLS in PowerBI using DAX editor in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Data-using-MID-and-SWITCH-functions-to-apply-RLS-in/m-p/4057770#M161051</link>
    <description>&lt;P&gt;Hey folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have school data to filter using ENumbers where numbers are staring with 'E' followed by any 3 digits(eg. E1234, E2134, E3124, E4321). If the first number followed by 'E' is starting with 1 it should return data for School 'A', with 2, data for School'B', and so on.&amp;nbsp; I want to apply RLS so that only 'school A' can see the data related to that school and so is the others.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an exaple which I've applied in SSMS using DAX, working fine while retrieving the data but giving me an error while applying it with DAX editor to apply RLS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EVALUATE&amp;nbsp;&lt;BR /&gt;  SELECTCOLUMNS(&lt;STRONG&gt;&lt;U&gt;SchoolInfo&amp;nbsp;&lt;/U&gt;&lt;/STRONG&gt;&lt;BR /&gt;  , "SchoolENumber", SchoolInfo[CEM ENumber]&lt;BR /&gt;  , "SchoolCode" , MID(SchoolInfo[CEM ENumber],2,1)&lt;BR /&gt;  , "SchoolLabel" , SWITCH( &lt;I&gt;&lt;U&gt;MID(SchoolInfo[CEM ENumber],2,1)&lt;/U&gt;&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;            , "1" , "A"&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;            , "2" , "B"&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;            , "3" , "C"&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;            , "4" , "D"&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;            , "Unknown")&lt;/I&gt;&lt;BR /&gt;  )&lt;/P&gt;&lt;P&gt;&amp;nbsp;If anyone can help me with this that would be great. Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2024 05:26:38 GMT</pubDate>
    <dc:creator>dhruvip23</dc:creator>
    <dc:date>2024-07-24T05:26:38Z</dc:date>
    <item>
      <title>Filtering Data using MID and SWITCH functions to apply RLS in PowerBI using DAX editor</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Data-using-MID-and-SWITCH-functions-to-apply-RLS-in/m-p/4057770#M161051</link>
      <description>&lt;P&gt;Hey folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have school data to filter using ENumbers where numbers are staring with 'E' followed by any 3 digits(eg. E1234, E2134, E3124, E4321). If the first number followed by 'E' is starting with 1 it should return data for School 'A', with 2, data for School'B', and so on.&amp;nbsp; I want to apply RLS so that only 'school A' can see the data related to that school and so is the others.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an exaple which I've applied in SSMS using DAX, working fine while retrieving the data but giving me an error while applying it with DAX editor to apply RLS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EVALUATE&amp;nbsp;&lt;BR /&gt;  SELECTCOLUMNS(&lt;STRONG&gt;&lt;U&gt;SchoolInfo&amp;nbsp;&lt;/U&gt;&lt;/STRONG&gt;&lt;BR /&gt;  , "SchoolENumber", SchoolInfo[CEM ENumber]&lt;BR /&gt;  , "SchoolCode" , MID(SchoolInfo[CEM ENumber],2,1)&lt;BR /&gt;  , "SchoolLabel" , SWITCH( &lt;I&gt;&lt;U&gt;MID(SchoolInfo[CEM ENumber],2,1)&lt;/U&gt;&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;            , "1" , "A"&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;            , "2" , "B"&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;            , "3" , "C"&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;            , "4" , "D"&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;            , "Unknown")&lt;/I&gt;&lt;BR /&gt;  )&lt;/P&gt;&lt;P&gt;&amp;nbsp;If anyone can help me with this that would be great. Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 05:26:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Data-using-MID-and-SWITCH-functions-to-apply-RLS-in/m-p/4057770#M161051</guid>
      <dc:creator>dhruvip23</dc:creator>
      <dc:date>2024-07-24T05:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering Data using MID and SWITCH functions to apply RLS in PowerBI using DAX editor</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Data-using-MID-and-SWITCH-functions-to-apply-RLS-in/m-p/4057869#M161057</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="770872" data-lia-user-login="dhruvip23" class="lia-mention lia-mention-user"&gt;dhruvip23&lt;/a&gt;&amp;nbsp;，&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;not sure if i really get your point, but you might need to add the SchoolLabel column as calculated column and use that column for RLS.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 05:19:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Data-using-MID-and-SWITCH-functions-to-apply-RLS-in/m-p/4057869#M161057</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2024-07-24T05:19:43Z</dc:date>
    </item>
  </channel>
</rss>

