Forum Discussion
AmiraBedh
2 years agoSuper User
Distribute COUNT for Types seperated by /
I have the following table : COI Type COI ID Client vs Client 125 Client vs N 5636 B vs N Client 54 Client vs Client/B vs N Client 51 Client...
- 2 years ago
I ended up using this solution :
Special Count = COUNTROWS( FILTER( ALLSELECTED('YourTable'), CONTAINSSTRING('YourTable'[OP Type], SELECTEDVALUE('YourTable'[OP Type])) ) )powerbi - Distribute COUNT for Types seperated by / - Stack Overflow
amustafa
2 years agoSolution Sage
I had to trim and clean your sample data column "COI Type" beacsue it contained some trailing spaces. Anyhow, I split the values where it found a slash "/" them merged it in Power Query. See the M code and results below. You can aslo download my work files.
let
Source = Excel.Workbook(File.Contents("C:\Users\aliom\OneDrive\Power BI Samples\Unique Type ID count\Sample.xlsx"), null, true),
Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Table1_Table,{{"COI Type", type text}, {"COI ID", Int64.Type}}),
#"Trimmed Text" = Table.TransformColumns(#"Changed Type",{{"COI Type", Text.Trim, type text}}),
#"Cleaned Text" = Table.TransformColumns(#"Trimmed Text",{{"COI Type", Text.Clean, type text}}),
#"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Cleaned Text", {{"COI Type", Splitter.SplitTextByDelimiter("/", QuoteStyle.Csv), type list}}), "COI Type"),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"COI Type", type text}})
in
#"Changed Type1"
Download link:
If I answered your question, please mark this thread as accepted and Thums Up!
Follow me on LinkedIn:
https://www.linkedin.com/in/mustafa-ali-70133451/