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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Not able to apply distinct count on mutiple criteria on column/measure

Hi folks,

I have to apply simple Distinct count formula based on mutiple criteria

 
 
RegionStateDB CodeDB NameChannel CodeFlagChannel
EastAssam103393ASHOK KUMAR JAIN & CO.(BLC-TINSUKIA)    5200Primp>s
EastBihar103505ASHOK UDYOG(BLC-FORBESGANJ)             5200Primp>s
EastWest Bengal106652RAMKRISHNA PAPER HOUSE (SILIGURI)       5200PrimPrim
EastWest Bengal1089ASHIS KUMAR RUDRA(NAIHATI)              5200Primp>s
EastWest Bengal11068KALIMATA DIST.HOUSE(MOGRA)              5200Primp>s
EastJharkhand11073CSD Ramgarh                             5400Primp>s
EastWest Bengal1118CSD Kolkata                             5400Primp>s
EastWest Bengal1128DAMANI STORES-PURULIA                   5200secsec
EastWest Bengal1129JANATA STATIONERY ST.(BLC)-RNGJ         5200secsec
EastWest Bengal1134SRI DURGA SALES AGENCY-BRKR             5200secsec
EastWest Bengal122977TARAMA AGENCY(BLC-JAGACHA)              5200secsec
       
  Result Required    
  prim=7    
  Sec+P>s=10    
 

I am very sad about Power BI  behaviour. it is not allowing the flexibility as tableau. Tablea is far better than PBI

Request you guys please help me

 

 
 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
dedelman_clng
Community Champion
Community Champion

Hi @Anonymous  - you're not very clear about what you're trying to do, but here's how to get the results you are looking for:

 

Prim = COUNTROWS(FILTER(Table2, Table2[Flag]="PRIM"))

SecOrPgtS = COUNTROWS(FILTER(Table2, Table2[Channel] in {"P>S", "sec"}))

2021-01-18 14_04_37-scratch4 - Power BI Desktop.png

 

If that is not what you're looking for, please expand on the description of what you are trying to do.

 

Hope this helps

David

View solution in original post

2 REPLIES 2
dedelman_clng
Community Champion
Community Champion

Hi @Anonymous  - you're not very clear about what you're trying to do, but here's how to get the results you are looking for:

 

Prim = COUNTROWS(FILTER(Table2, Table2[Flag]="PRIM"))

SecOrPgtS = COUNTROWS(FILTER(Table2, Table2[Channel] in {"P>S", "sec"}))

2021-01-18 14_04_37-scratch4 - Power BI Desktop.png

 

If that is not what you're looking for, please expand on the description of what you are trying to do.

 

Hope this helps

David

Anonymous
Not applicable

Hi David,

 

Thanks for reply.

I have resolved this myself

Pri_DB_Count = CALCULATE(DISTINCTCOUNT('db_CSA_Data Yield_Sec_Test'[DistributorCode]),FILTER('db_CSA_Data Yield_Sec_Test','db_CSA_Data Yield_Sec_Test'[Primary/Secondary]="Primary"))
Sec_DB_Count = CALCULATE(DISTINCTCOUNT('db_CSA_Data Yield_Sec_Test'[DistributorCode]),FILTER('db_CSA_Data Yield_Sec_Test','db_CSA_Data Yield_Sec_Test'[ChannelName]<>"5200"))
Thanks

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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