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
Boycie92
Resolver I
Resolver I

Count Unique Rows using two columns

Hi,

 

I was wondering if someone can help

 

I have a model set up using direct query.

 

I have two column each have duplicates I want to be able to create a measure that would count only unique rows from BOTH columns

 

For Example:

 

Column A            Column B

 

1                              A

2                              B

3                              C

4                              D

1                              A

4                              E

3                              C

 

I was be expecting a total of 5 unique rows (what I want the measure to show).

 

As I have 2 rows that are Column A: 1 and Column B: A (should only count one row)

I also have two rows that are Column A: 3 and Column B: C (should only count one row)

I also have two other rows:

  • 1st Row Column A: 4 and Column B: D
  • 2nr Row Column A: 4 and Column B: E
  • Both of these rows should be counted as they do not share the same values

 

Is there any way to achieve this?

 

Thanks in advance,

 

Boycie92

1 ACCEPTED SOLUTION

3 REPLIES 3
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @Boycie92,

After test, the measure formula @Zubair_Muhammad posted is right. You can create a card visual to show the result.

1.PNG

Please mark the right reply as answer, so more people will find workaround easily and clearly.

Best Regards,
Angelia

RolandsP
Resolver IV
Resolver IV

You could combine 2 columns into a new column:

 

Combine = COMBINEVALUES("_", Table[ColumnA], Table[ColumnB])

 

And then do a distinct count on the new column:

 

Unique rows = DISTINCTCOUNT(Table[Combine])

@Boycie92

 

MEASURE =
COUNTROWS ( DISTINCT ( Table_Name ) )

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.