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

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

Reply
vnqtrang
Helper I
Helper I

Distinctcount with filter compare the values

Hi ,

I have the table below : 

 

True/FALSE

Server

Name

CODE

True

110.200.1999, 22.333.222

AA

EE000QQ0001

True110.200.1999BB

EE000QQ0002

True

110.200.1999, 10.200.3000

BE

EE000QQ0002

True

110.200.1999, 10.200.3000

ZE

EE000QQ0003

True

110.200.1999, 10.200.3000

RF

EE000QQ0004

True

110.200.1999, 10.200.3000

SD

EE000QQ0005

True

10.200.3000, 110.200.1999

ZD

EE000QQ0006

True

110.200.1999, 22.333.222

WQ

EE000AA0001

True

22.333.222, 110.200.1999, 22.333.333

QS

AA800VBB0001

 

110.200.1999, 22.333.222

XQ

AA800VBB0001

True

22.333.222, 110.200.1999

WQ

AA800VBB0004

True

110.200.1999, 22.333.222

AEZ

AA800VBB0001

False

22.333.222, 110.200.1999, 22.333.333

DF

AA800VBB0001

True

110.200.1999, 22.333.222

KU

AA800VBB0001

True

22.333.222, 110.200.1999, 22.333.333

ED

AP800VBB0005

 

 I would like to distinctcount the column Name with the filtre of only True (column True/FALSE) and the same CODE must have the same Server.

 

Calculate(distinctcount(tableA[Name], Filter(tableA, TableA[True/FALSE]="True" && ALL SAME [CODE] have SAME [Server]))

 

Thank you in advance.

Tg

2 ACCEPTED SOLUTIONS
marveling
Regular Visitor

Hi, 

 

I think you can use this:

 

 

 

DistinctCount =
CALCULATE (
    DISTINCTCOUNT ( 'TableA'[Name] ),
    REMOVEFILTERS (),
    SUMMARIZE ( TableA, 'TableA'[Server], 'TableA'[CODE] ),
    'TableA'[True/FALSE] = "True"
)

 

 

Let me know if it works.

 

Thanks,

M

 

If this post helps, please consider Accepting it as the solution to help other members find it more quickly.

 

View solution in original post

Anonymous
Not applicable

Hi  @vnqtrang ,

Here are the steps you can follow:

1. Create calculated column.

column =
IF(
    'Table'[True/FALSE]="True",
CALCULATE(
    DISTINCTCOUNT('Table'[Name]),
    FILTER(ALL('Table'),
    'Table'[True/FALSE]="True"&&'Table'[Server]=EARLIER('Table'[Server])&&
    'Table'[CODE]=EARLIER('Table'[CODE]))))

2. Result:

vyangliumsft_0-1658475556336.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi  @vnqtrang ,

Here are the steps you can follow:

1. Create calculated column.

column =
IF(
    'Table'[True/FALSE]="True",
CALCULATE(
    DISTINCTCOUNT('Table'[Name]),
    FILTER(ALL('Table'),
    'Table'[True/FALSE]="True"&&'Table'[Server]=EARLIER('Table'[Server])&&
    'Table'[CODE]=EARLIER('Table'[CODE]))))

2. Result:

vyangliumsft_0-1658475556336.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Ashish_Mathur
Super User
Super User

Hi,

Please show the expected result very clearly.  Do you definitely want only a measure solution or would you be OK with a combination of Power Query, calculated columns and measure solution?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
marveling
Regular Visitor

Hi, 

 

I think you can use this:

 

 

 

DistinctCount =
CALCULATE (
    DISTINCTCOUNT ( 'TableA'[Name] ),
    REMOVEFILTERS (),
    SUMMARIZE ( TableA, 'TableA'[Server], 'TableA'[CODE] ),
    'TableA'[True/FALSE] = "True"
)

 

 

Let me know if it works.

 

Thanks,

M

 

If this post helps, please consider Accepting it as the solution to help other members find it more quickly.

 

Sahil006090
Regular Visitor

1. Go to the PowerQuery Editor create a duplicate of TableA(2) and filter the table with only True/False="True"

2. Create a Custom Column to TableA(2) named Key (in my case)

 

Sahil006090_2-1658251462910.png

 

 

3. Create a GroupBy on Key and Name column.

Sahil006090_3-1658251523968.png

 

 

4- Close and Apply All the changes

5- Create a DAX measure calculate(distinctcount(tableA (2)) and use this.

If this works then please mark this post as solution.

 

could you please advise the DAX, I tried mine but doesn't work.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.