<?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: Multiple Flags for same Reference Number in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-Flags-for-same-Reference-Number/m-p/4074860#M161780</link>
    <description>&lt;P&gt;Wow, thank you very much. I used option 2 and it worked perfectly. I am now going to study the syntax in the measure. Really appreciate your help &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 02 Aug 2024 03:11:35 GMT</pubDate>
    <dc:creator>Lachlanpap</dc:creator>
    <dc:date>2024-08-02T03:11:35Z</dc:date>
    <item>
      <title>Multiple Flags for same Reference Number</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-Flags-for-same-Reference-Number/m-p/4074493#M161769</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have three flags being Blank, Provisional and Final attached to the same reference number. The reference number can be at any three stages of coding. If the reference number has the status Final there will be two other lines one for Blank and the other for Provisional. I only want to extract the Final line of coding for the reference number and ignore Blank and Provisional.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can not just filter on Final as some of the reference numbers might only be at the Blank stage of coding or Blank and Provisional. I want to extract only the reference number applicable to the lines stage of coding.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated. I am assuming this problem can be solved using DAX or potentially in Power Query.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 23:47:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-Flags-for-same-Reference-Number/m-p/4074493#M161769</guid>
      <dc:creator>Lachlanpap</dc:creator>
      <dc:date>2024-08-01T23:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Flags for same Reference Number</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-Flags-for-same-Reference-Number/m-p/4074620#M161773</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try creating a calculated column like this for example:&lt;/P&gt;&lt;P&gt;IsFinal =&lt;BR /&gt;VAR CurrentRefNumber = 'YourTable'[ReferenceNumber]&lt;BR /&gt;VAR HasFinal =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS('YourTable'),&lt;BR /&gt;'YourTable'[ReferenceNumber] = CurrentRefNumber,&lt;BR /&gt;'YourTable'[Flag] = "Final"&lt;BR /&gt;) &amp;gt; 0&lt;BR /&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;HasFinal,&lt;BR /&gt;IF(&lt;BR /&gt;'YourTable'[Flag] = "Final",&lt;BR /&gt;TRUE(),&lt;BR /&gt;FALSE()&lt;BR /&gt;),&lt;BR /&gt;FALSE()&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;This column will return TRUE if the reference number has a "Final" status and FALSE otherwise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, you can use this calculated column to filter your data in your visuals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or a measure like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FinalFlagMeasure =&lt;BR /&gt;IF(&lt;BR /&gt;COUNTROWS(&lt;BR /&gt;FILTER(&lt;BR /&gt;'YourTable',&lt;BR /&gt;'YourTable'[Flag] = "Final" &amp;amp;&amp;amp;&lt;BR /&gt;'YourTable'[ReferenceNumber] = MAX('YourTable'[ReferenceNumber])&lt;BR /&gt;)&lt;BR /&gt;) &amp;gt; 0,&lt;BR /&gt;1,&lt;BR /&gt;0&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;This measure returns 1 if the reference number has a "Final" status and 0 otherwise.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 01:46:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-Flags-for-same-Reference-Number/m-p/4074620#M161773</guid>
      <dc:creator>Shravan133</dc:creator>
      <dc:date>2024-08-02T01:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Flags for same Reference Number</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-Flags-for-same-Reference-Number/m-p/4074649#M161778</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="723032" data-lia-user-login="Lachlanpap" class="lia-mention lia-mention-user"&gt;Lachlanpap&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT&gt;If I understand correctly, blank, p&lt;SPAN&gt;rovisional&amp;nbsp;&lt;/SPAN&gt;and final are sequential.&amp;nbsp;I'm assuming the raw data looks like this;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;PowerQuery M:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table,
    #"Grouped Rows" = Table.Group(Source, {"reference number"}, {{"Data", each Table.LastN(_, 1)}}),
    #"Expanded Data" = Table.ExpandTableColumn(#"Grouped Rows", "Data", {"flags"}, {"flags"})
in
    #"Expanded Data"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dax:&lt;/P&gt;
&lt;P&gt;first create a new enter table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;then relationship:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;then please create a new measure:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR __cur_sort =  CALCULATE( MAX('DimFlag'[FlagSort]), CROSSFILTER('Table'[flags],'DimFlag'[flags],Both))
VAR __max_sort = CALCULATE( MAX('DimFlag'[FlagSort]), CROSSFILTER('Table'[flags],'DimFlag'[flags],Both) ,ALLEXCEPT('Table','Table'[reference number]),VALUES('Table'[reference number]))
VAR __result = IF( __cur_sort = __max_sort, 1)
RETURN
__result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and use it as table visual's filter:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Best Regards,&lt;BR /&gt;Gao&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Community Support Team&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;If there is any post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3" color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3"&gt;&lt;FONT color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT size="3"&gt;Thanks a lot!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener nofollow noreferrer"&gt;How to get your questions answered quickly&lt;/A&gt;&amp;nbsp;--&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener nofollow noreferrer"&gt;&amp;nbsp;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 01:56:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-Flags-for-same-Reference-Number/m-p/4074649#M161778</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-02T01:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Flags for same Reference Number</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-Flags-for-same-Reference-Number/m-p/4074860#M161780</link>
      <description>&lt;P&gt;Wow, thank you very much. I used option 2 and it worked perfectly. I am now going to study the syntax in the measure. Really appreciate your help &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 03:11:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-Flags-for-same-Reference-Number/m-p/4074860#M161780</guid>
      <dc:creator>Lachlanpap</dc:creator>
      <dc:date>2024-08-02T03:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Flags for same Reference Number</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-Flags-for-same-Reference-Number/m-p/4074865#M161781</link>
      <description>&lt;P&gt;Thanks for your reply Shravan133. I ended up using option 2 from Gao above. I appreciate your response regardless&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 03:13:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-Flags-for-same-Reference-Number/m-p/4074865#M161781</guid>
      <dc:creator>Lachlanpap</dc:creator>
      <dc:date>2024-08-02T03:13:24Z</dc:date>
    </item>
  </channel>
</rss>

