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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Show and count matching data from 1 table

Hello, 

 

there are 3 companies and a lot of customers. I would like to see Customers that are not reached by Each company and count numbers etc. . .  this is the table I have. 

CustomerNameCompanyName
AAAA
AAAB
BBBC
CCCA
CCCB
CCCC
DDDA
DDDC
EEEB

 

the result I want to see is: The customers that reached by all 3 companies. 

Result 1: 

CompanyNameIsNotCovering
ABBB
AEEE
BBBB
BDDD
CAAA
CEEE

 

Result 2:  Company "B" covers but C does not:

CompanyNameIsNotCovering
CAAA
CEEE

 

Result 3:  all companies with the customers that they are not covering.

CompanyNameIsNotCovering
ABBB
AEEE
BBBB
BDDD
CAAA
CEEE

 

I would like to do it using DAX measure, new column.  without using Filter Pane.  (or maybe also not using Slicer (If possible.))

 

I did search from google and Power BI forums. but did not quite found what I wanted. 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

 

not sold to customer , this will give a table , can be used in a measure -all companies with the customers that they are not covering.
new Table = except(crossjoin(distinct(Table[CustomerName]),distinct(Table[CompanyName])), Table)

 

The customers reached by all 3 companies.
Measure = countx(filter(summarize(Table, Table[CustomerName] ,"_1", distinctCOUNT(Table[CompanyName]) ,"_2", calculate(distinctCOUNT(Table[CompanyName]), all(Table))),[_1]=[_2]),[CustomerName])

 

Result 2: Company "B" covers but C does not:
new Table 2 = except(summarize(filter(Table,Table[CompanyName] ="B"),Table[CustomerName]),summarize(filter(Table,Table[CompanyName] ="C"),Table[CustomerName]))

 

measure = calculate(count(Table[CustomerName]), filter(Table,Table[CustomerName] in except(summarize(filter(Table,Table[CompanyName] ="B"),Table[CustomerName]),summarize(filter(Table,Table[CompanyName] ="C"),Table[CustomerName])) && Table[CompanyName] ="B")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try like

 

not sold to customer , this will give a table , can be used in a measure -all companies with the customers that they are not covering.
new Table = except(crossjoin(distinct(Table[CustomerName]),distinct(Table[CompanyName])), Table)

 

The customers reached by all 3 companies.
Measure = countx(filter(summarize(Table, Table[CustomerName] ,"_1", distinctCOUNT(Table[CompanyName]) ,"_2", calculate(distinctCOUNT(Table[CompanyName]), all(Table))),[_1]=[_2]),[CustomerName])

 

Result 2: Company "B" covers but C does not:
new Table 2 = except(summarize(filter(Table,Table[CompanyName] ="B"),Table[CustomerName]),summarize(filter(Table,Table[CompanyName] ="C"),Table[CustomerName]))

 

measure = calculate(count(Table[CustomerName]), filter(Table,Table[CustomerName] in except(summarize(filter(Table,Table[CompanyName] ="B"),Table[CustomerName]),summarize(filter(Table,Table[CompanyName] ="C"),Table[CustomerName])) && Table[CompanyName] ="B")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Wow. thank you very much, sir. Everything is working like magic. 

 

/* 

Could you please tell me what does the last measure do? the result is 2. but I am not quite sure that that is counting. 

this one ->   measure = calculate(count(Table[CustomerName]), filter(Table,Table[CustomerName] in except(summarize(filter(Table,Table[CompanyName] ="B"),Table[CustomerName]),summarize(filter(Table,Table[CompanyName] ="C"),Table[CustomerName])) && Table[CompanyName] ="B")

*/ -- I got this one. If I am not wrong, this one is the measure to count: "Result 2: Company "B" covers but C does not:" 

 

 

edit: 

not sold to customer , this will give a table , can be used in a measure -all companies with the customers that they are not covering.

NewTable = EXCEPT(CROSSJOIN(DISTINCT('Table'[CustomerName]),DISTINCT('Table'[CompanyName])), 'Table')

How Can I add a filter to this? for example,

1. Show a list of all companies (except company C) with the customers that they are not covering. 

2. I would like to show a list of all CustomerNames visited by all Companies except Company"C"

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors