Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

How would you approach this scenario?

Below is my target results that I am trying to achieve (please see screenshot below). Extracting very specific call status types from a string with in a column that currently has " " as delimiters, c...
  • AlexisOlson's avatar
    AlexisOlson
    7 years ago

    The basic steps would be:

     

    1. Split the column by "," delimiter.
    2. Unpivot all the new columns.
    3. Remove nulls as desired.
    4. Split those new columns into their components.
    5. Load this table into your report and do the concatenation aggregation on the component columns using measures.

    You should be able to create filters on these component columns now.

     

    Here's an example query based on a small subset of your data that you can paste into your query editor:

     

    let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fVFdT8MgFP0rhCdNqrlA14/HZUbdQ93M+rbuobZkJSIkDGr89942btGlNYRLyLkczj1nv6ebpx1ZmzacvFPyRCO6fHfW4Ll5xvK4u2MZLDgH4DdFLjgnFV11tTvKit5G5AcHBlxc8K2TvTS+9qqXpKiV8b96Y6Ri+TwX5wxAzOEpZLjjeB5PB47Z9wnjgDibwOkhQjec65W2Bi1p7gcTxruWf/0QPAGBfyxYMjnDFf6PHyn2MfRkgmvU8xpqrfwXKa3VpAqYQkIe1CCnkHV7lrZdYhn7SxuarrWfhpSy6YzV9oipnqdZWR0+3sKQ8vrlMk2CC9DROM/iKwWHbw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [site_name = _t, city = _t, state_id = _t, FS_ticket_within_2yr = _t]),
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "FS_ticket_within_2yr", Splitter.SplitTextByDelimiter(", ", QuoteStyle.None), {"FS_ticket_within_2yr.1", "FS_ticket_within_2yr.2", "FS_ticket_within_2yr.3", "FS_ticket_within_2yr.4", "FS_ticket_within_2yr.5", "FS_ticket_within_2yr.6", "FS_ticket_within_2yr.7", "FS_ticket_within_2yr.8"}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Split Column by Delimiter", {"site_name", "city", "state_id"}, "Attribute", "Value"),
    #"Filtered Rows" = Table.SelectRows(#"Unpivoted Columns", each [Value] <> null),
    #"Split Column by Delimiter1" = Table.SplitColumn(#"Filtered Rows", "Value", Splitter.SplitTextByEachDelimiter({"("}, QuoteStyle.None, false), {"Value.1", "Value.2"}),
    #"Split Column by Delimiter2" = Table.SplitColumn(#"Split Column by Delimiter1", "Value.2", Splitter.SplitTextByDelimiter("""", QuoteStyle.None), {"Value.2.1", "Value.2.2", "Value.2.3"}),
    #"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter2",{"Value.2.3", "Attribute"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Value.1", "FS"}, {"Value.2.1", "M"}, {"Value.2.2", "Descr"}})
    in
    #"Renamed Columns"