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
MasterSonic
Helper IV
Helper IV

Count unique per other columns

Hello,

CodePlanStatus
101BuyReady
102SellReady
102SellReady


I would like to count unique code by Status and Planm but I have duplicates in Code column.

So on Report,  I could drop Plan and "Count of Status" showing 1 for Plan SELL, based on table above.



I have this measurment but it doesn't do the job, as is showing 2, counting Code per plan ONLY, without looking at Status

Measur1 = CALCULATE(DISTINCTCOUNT('Table'[Code]),ALLEXCEPT('Table'[Plan]))

Is there any way to perform calculaction please?
1 ACCEPTED SOLUTION

not sure if i get you, try this

Measure2 = 

COUNTROWS(
    SUMMARIZE(
        TableName, 
        TableName[Plan], 
        TableName[Code]
    )
)

View solution in original post

4 REPLIES 4
FreemanZ
Super User
Super User

hi   @MasterSonic 

try like:
 
Measure2 = 
COUNTROWS(
    SUMMARIZE(
        TableName, 
        TableName[Plan], 
        TableName[Status]
    )
)

Hi,
thanks but It does not give the wanted result.

lets extend my table

CodePlanStatus
101BuyReady
102SellReady
102SellReady
103SellReady


Now it should showing  col=Plan value=Sell  should be 2
As we have code duplicated.

I would like to count Code per Plan where value in column Status is Ready, but do not count duplicated Codes. Maybe this will help

not sure if i get you, try this

Measure2 = 

COUNTROWS(
    SUMMARIZE(
        TableName, 
        TableName[Plan], 
        TableName[Code]
    )
)

Thank You for help I have added below and I got what wanted.

Measure2 = 

COUNTROWS(
    SUMMARIZE( FILTER( Table,Table[Status] = "Ready"),
        
        TableName[Plan], 
        TableName[Code]
    )
)

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

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.