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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Measure

i have my data as follows

Case NumberProcedure code
1505SN21
1505SN21
1505SN23
1508SN21
1508MR28
1509SN21
1510MR28
1511SN23
1512SN23
1509SN21
1513SN21
1513SN21


I am trying to create a measure that counts unique "CaseNumbers" that are carrying "SN21" procedure Code.

(or)

Count of CaseNumbers that has SN21 procedure code repeated twice. 

2 ACCEPTED SOLUTIONS
Fowmy
Super User
Super User

@Anonymous 

You can use this measure:

Unique Case Numbers = 

CALCULATE(
    DISTINCTCOUNT(Table[Case Number]),
    Table[Procedure code] = "SN21" 
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

@Anonymous 

Try this:

Unique Case Numbers = 
CALCULATE(
    COUNT(Table2[Case Number]),
    Table2[Procedure code] = "SN21" 
)
-
CALCULATE(
    DISTINCTCOUNT(Table2[Case Number]),
    Table2[Procedure code] = "SN21" 
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Fowmy
Super User
Super User

@Anonymous 

You can use this measure:

Unique Case Numbers = 

CALCULATE(
    DISTINCTCOUNT(Table[Case Number]),
    Table[Procedure code] = "SN21" 
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Is there any way to use this expression to subract the SN21 procedure total count - SN21 procedure distinct ocunt!!

@Anonymous 

Try this:

Unique Case Numbers = 
CALCULATE(
    COUNT(Table2[Case Number]),
    Table2[Procedure code] = "SN21" 
)
-
CALCULATE(
    DISTINCTCOUNT(Table2[Case Number]),
    Table2[Procedure code] = "SN21" 
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

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.