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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
DagmaraG
Frequent Visitor

distinct count of occurence by category

Hi!

I have table with

Product and Value fields

 

I need to count nr of products which have more then 9 occurences of Values.

I tried this measure, but I guess its different contex.

 CALCULATE(DISTINCTCOUNT(Table[Product]), FILTER(Table, DISTINCTCOUNT(Value) > 9))

DagmaraG_0-1678282513841.png

 

2 ACCEPTED SOLUTIONS
FreemanZ
Super User
Super User

hi @DagmaraG 

try like:

Measure =
VAR _table =
ADDCOLUMNS(
    VALUES(TableName[Product]),
    "Count",
     CALCULATE(COUNTROWS(TableName))
)
RETURN
COUNTROWS(
    FILTER(
        _table,
        [Count]>9
    )
)

View solution in original post

v-zhangti
Community Support
Community Support

Hi, @DagmaraG 

 

You can try the following methods.

vzhangti_0-1678688441539.png

Measure:

Count1 = COUNT('Table'[Product])
Count2 = CALCULATE(DISTINCTCOUNT('Table'[Product]),FILTER(ALL('Table'),[Count1]>=9))

vzhangti_1-1678688495666.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @DagmaraG 

 

You can try the following methods.

vzhangti_0-1678688441539.png

Measure:

Count1 = COUNT('Table'[Product])
Count2 = CALCULATE(DISTINCTCOUNT('Table'[Product]),FILTER(ALL('Table'),[Count1]>=9))

vzhangti_1-1678688495666.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

 

FreemanZ
Super User
Super User

hi @DagmaraG 

try like:

Measure =
VAR _table =
ADDCOLUMNS(
    VALUES(TableName[Product]),
    "Count",
     CALCULATE(COUNTROWS(TableName))
)
RETURN
COUNTROWS(
    FILTER(
        _table,
        [Count]>9
    )
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.