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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Postigo
Frequent Visitor

Using distinctcount as a filter

Hello everyone,

here is a issue i'm facing:

i have two tables (Products and Sales) and i need to have a measure to show me how many products i have that more than 3 different Clients bought(in this case only the top 4 lines will be true)

Postigo_0-1653931406733.png

i already tried something like this


Measure =
var Table1 =
CALCULATETABLE(
SUMMARIZE(
'Product',
'Product'[SK_PRODUCT],
"teste",DISTINCTCOUNT(Sales[SK_CLIENT])
),
DISTINCTCOUNT(Sales[SK_CLIENT])>3
 
)
return

COUNTROWS(Table1)



But it doesn't work, it's possible to solve this with measures? My company data is build in Tabular model and power bi not allows to have two different data sources in this case

File Example
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

var Table1 =
Filter(
SUMMARIZE(
'Product',
'Product'[SK_PRODUCT],
"teste",DISTINCTCOUNT(Sales[SK_CLIENT])
),
[teste]>3)
 
)
return

 

COUNTROWS(Table1)

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

var Table1 =
Filter(
SUMMARIZE(
'Product',
'Product'[SK_PRODUCT],
"teste",DISTINCTCOUNT(Sales[SK_CLIENT])
),
[teste]>3)
 
)
return

 

COUNTROWS(Table1)

Perfect James!!

Thanks a lot

Postigo
Frequent Visitor

Hello JamesFr06, thanks for your reply.

I can't do that way, what i need is the number of rows of this solution you shared above, in the DAX example i used i tried to create this example as a variable and use the COUNTROWS() on it, but it doesn't work

Anonymous
Not applicable

llo

 

Why dont you use the filter ?

JamesFr06_0-1653933138845.png

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.