Forum Discussion

MichaelHutchens's avatar
5 years ago
Solved

Find string matches from a separate table

Hi folks, I'm hoping to get some assistance. I need to create a report that takes a list of strings ("Application" table) as an input, counts the number of text strings separated by spaces, and ...
  • parry2k's avatar
    5 years ago

    MichaelHutchens why you have partial code, my code is way too long, not sure if you are not seeing the full code:

     

    Word Found Count = 
    VAR __word = SUBSTITUTE ( 'Application'[Name], " ", "|" )
    VAR __wordTable = GENERATESERIES ( 1, PATHLENGTH ( __word ) )
    VAR __wordsTable = ADDCOLUMNS ( __wordTable, "@Word", PATHITEM ( __word, [Value] ) ) 
    
    VAR __add1 = 
    ADDCOLUMNS ( __wordsTable, 
        "Found Count", 
        SUMX ( 
            'Description', 
            VAR __desc = SUBSTITUTE ( 'Description'[Description], " ", "|" )
            VAR __descTable = GENERATESERIES ( 1, PATHLENGTH ( __desc ) )
            VAR __descTableWord = ADDCOLUMNS ( __descTable, "@Description", PATHITEM ( __desc, [Value] ) ) 
            VAR __descValues = SELECTCOLUMNS ( __descTableWord, "@Description", [@Description] )
            RETURN 
            ( [@Word] IN __descValues ) + 0 
        ) 
    )
    RETURN
    CONCATENATEX ( __add1, [Found Count], "," )

     

    Check my latest blog post Improve UX: Show Year in Legend When Using Time Intelligence Measures | PeryTUS IT Solutions  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.