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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
tyan
Helper II
Helper II

how to filter distinct condition and do calculate?

Hi, On the right side is my data and on the left side is the result that i am looking for.  I try to set up a filter that only count completely cancel colorway which means the brand has that color but only do with cancel, no improve/ ok

thank you so much for helping me.

 

tyan_0-1636990975410.png

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Thanks @tyan 

In that case, your percentage measures can be something like:

 

 

Colorway Cancellation % =
DIVIDE ( 
    [Completely cancel coloway],
    CALCULATE ( DISTINCTCOUNT ( Data[Color] ), ALLSELECTED ( ) )
    -- ALLSELECTED seems to be what you want but you could use ALL to ignore all filters
)

 

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

3 REPLIES 3
OwenAuger
Super User
Super User

Thanks @tyan 

In that case, your percentage measures can be something like:

 

 

Colorway Cancellation % =
DIVIDE ( 
    [Completely cancel coloway],
    CALCULATE ( DISTINCTCOUNT ( Data[Color] ), ALLSELECTED ( ) )
    -- ALLSELECTED seems to be what you want but you could use ALL to ignore all filters
)

 

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn
OwenAuger
Super User
Super User

Hi @tyan 

 

For your first measure, you can write this:

Completely cancel coloway =
SUMX (
    SUMMARIZE ( Data, Data[Brand], Data[Color] ),
    INT ( CALCULATE ( SELECTEDVALUE ( Data[analysis] ) = "cancel" ) )
)

 

This measure takes each combination of Brand & Color, and counts how many of these combinations have the single distinct value of analysis = "cancel", which should be equivalent to what you are wanting to calculate.

 

I wasn't sure on the logic behind the denominator in your percentage measure (6 in your example). How is that defined?

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

@OwenAuger   Hi thank you for helping me, It should be 5 instrand of 6 it is the total amount of color.  it is unique not count twice.  so  it is red, blue, green,black, pink. 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.