<?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: How to find values that contains the same string and mark them that this number is not Single in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-values-that-contains-the-same-string-and-mark-them/m-p/3193889#M115890</link>
    <description>&lt;P&gt;Hello Nurzh,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To clarify, are all the non-highlighted rows in your first image copies of the highlighted row? If so, the below should work in a calculated column:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Number of Copies = 
VAR MasterDocument = Table1[DocumentSourceCategory] IN { "Master Document", "Project Document" }
VAR DocNum = Table1[DocumentNumber]
VAR DocNumLength = LEN ( Table1[DocumentNumber] )
VAR DocNumFilteredTable =
-- filters for all documents that have the same "prefix" as that row's document number
FILTER (
    Table1,
    LEFT ( Table1[DocumentNumber], DocNumLength ) = DocNum
)
VAR Result =
IF (
    MasterCopy, -- checks that current row is a master document row
    COUNTROWS ( DocNumFilteredTable ) -- counts records from above filtered table
)

RETURN
Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I built a tiny sample dataset (and added the above as a calculated column). The results are as below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;----------------------------------&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Apr 2023 14:15:35 GMT</pubDate>
    <dc:creator>Wilson_</dc:creator>
    <dc:date>2023-04-18T14:15:35Z</dc:date>
    <item>
      <title>How to find values that contains the same string and mark them that this number is not Single</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-values-that-contains-the-same-string-and-mark-them/m-p/3193420#M115861</link>
      <description>&lt;P&gt;Hi Everyone!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table Document, and I want to add calculated column that shows me if each number present in dataset with copy or master category.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;All documents are divided into 4 categories: 1. Master Document 2. Project Document 3. Project Working Copy 4. Working Copy&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1,2 - is Master, 3,4 - is Copy.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Copy number always comes after the master number through a dash. And the length of document numbers is not fixed, it can be different&lt;/P&gt;&lt;P&gt;For example, in this case&amp;nbsp;1-300_1 -B-2002 is the master, and everything after it through a dash is already a copy&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Puprose of this task is to delete from the dataset numbers that present single without any copies.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example,&amp;nbsp;there are numbers that do not have a copy, they go alone, they need to be removed&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate for any help!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 10:51:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-values-that-contains-the-same-string-and-mark-them/m-p/3193420#M115861</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-18T10:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to find values that contains the same string and mark them that this number is not Single</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-values-that-contains-the-same-string-and-mark-them/m-p/3193889#M115890</link>
      <description>&lt;P&gt;Hello Nurzh,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To clarify, are all the non-highlighted rows in your first image copies of the highlighted row? If so, the below should work in a calculated column:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Number of Copies = 
VAR MasterDocument = Table1[DocumentSourceCategory] IN { "Master Document", "Project Document" }
VAR DocNum = Table1[DocumentNumber]
VAR DocNumLength = LEN ( Table1[DocumentNumber] )
VAR DocNumFilteredTable =
-- filters for all documents that have the same "prefix" as that row's document number
FILTER (
    Table1,
    LEFT ( Table1[DocumentNumber], DocNumLength ) = DocNum
)
VAR Result =
IF (
    MasterCopy, -- checks that current row is a master document row
    COUNTROWS ( DocNumFilteredTable ) -- counts records from above filtered table
)

RETURN
Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I built a tiny sample dataset (and added the above as a calculated column). The results are as below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;----------------------------------&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 14:15:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-values-that-contains-the-same-string-and-mark-them/m-p/3193889#M115890</guid>
      <dc:creator>Wilson_</dc:creator>
      <dc:date>2023-04-18T14:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to find values that contains the same string and mark them that this number is not Single</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-values-that-contains-the-same-string-and-mark-them/m-p/3195629#M116005</link>
      <description>&lt;P&gt;Hello Wilson,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for your solution of this case. But I did not check this formula, because before you provide the formula, I decided to go by another way and ot works for me. I created&amp;nbsp;a calculated column that will show the DocumentNumber itself, if it is a master, if the DocumentNumber refers to a copy, then show all numbers without the last dash and characters after it:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Document cut = if(Document[DocumentSourceCategory] in {"Master Document","Project Document"}, Document[DocumentNumber], 
LEFT(Document[DocumentNumber],FIND("#",SUBSTITUTE(Document[DocumentNumber],"-","#", LEN(Document[DocumentNumber])-LEN(SUBSTITUTE(Document[DocumentNumber],"-",""))))-1)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After this step marked duplicated values in this column:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Duplication check = var _curentRowID = Document[Document cut]
return COUNTROWS(FILTER(ALL(Document),_curentRowID = Document[Document cut]))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And finally get to another table all values that does not equal 1 to&amp;nbsp;&lt;SPAN&gt;show in dataset&amp;nbsp; documents only with copy or master category.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2023 11:12:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-values-that-contains-the-same-string-and-mark-them/m-p/3195629#M116005</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-19T11:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to find values that contains the same string and mark them that this number is not Single</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-values-that-contains-the-same-string-and-mark-them/m-p/3196033#M116032</link>
      <description>&lt;P&gt;Sounds good, Nurzh. Looks like we converged on very similar solutions. Glad you were able to solve this yourself. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2023 14:21:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-values-that-contains-the-same-string-and-mark-them/m-p/3196033#M116032</guid>
      <dc:creator>Wilson_</dc:creator>
      <dc:date>2023-04-19T14:21:09Z</dc:date>
    </item>
  </channel>
</rss>

