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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Ashish123
New Member

Measure for distinct count based on value from another column

I have the following dataset and I am trying to get the unique value from Name column where the value in Status column is 3 and value not 0 or 2. So the result should be only D.

Any help is greatly appreciated.

 

NameStatus
A0
B2
C3
D3
A2
C2
B0
A3
2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

This measure expression will return a single Name that meets your conditions.  Since you are expecting a single value, I assume you will use a card visual.

 

Name Just Status 3 =
VAR summary =
    SUMMARIZE (
        'Status',
        'Status'[Name],
        "@min"MIN ( 'Status'[Status] )
    )
RETURN
    MINX (
        FILTER (
            summary,
            [@min] = 3
        ),
        'Status'[Name]
    )

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


MattAllington
Community Champion
Community Champion

In DAX, you First filter, then calculate. Inside the calculate function, the first parameter is executed last. So. 


=CALCULATE(distinctcount(tablename[name]),tablename[status]=3)

 

the filter is applied first (last parameter), then the calculation is executed



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

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.