cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted

Re: Measure for distinct count based on value from another column

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 a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Highlighted
Super User III
Super User III

Re: Measure for distinct count based on value from another column

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? Please mark my post as a solution! Kudos are also appreciated!

Proud to be a Super User!




Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors