Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AmiraBedh
Resident Rockstar
Resident Rockstar

Distribute COUNT for Types seperated by /

I have the following table :
 
COI TypeCOI ID
Client vs Client                               125
Client vs N5636
B vs N Client54
Client vs Client/B vs N Client51
Client vs Client4
Client vs Client/B vs N Client5
Client vs N31
B vs N Client/ Client vs N45
 
 
I want to calculate the number of OP ID by  OP Type using this condition :
When for example we have :
a type seperated by / like Client vs Client/B vs N Client   
 
the count will be like below 1 goes to Client vs Client
and 1 goes to B vs N Client 1 
and 1 remains  for Client vs Client/B vs N Client
The output will be :
 
 
OP                            Count
Client vs Client              4
Client vs N                   3
B vs N Client                 4
Client vs Client/B vs N Client2
B vs N Client/ Client vs N    1

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
1 ACCEPTED SOLUTION
AmiraBedh
Resident Rockstar
Resident Rockstar

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


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

View solution in original post

2 REPLIES 2
AmiraBedh
Resident Rockstar
Resident Rockstar

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


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
amustafa
Super User
Super User

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"

 

 

amustafa_1-1707831950300.png

 

Download link:

Unique Type ID count

 

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/

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.