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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Distinctcount with Filters

Hello,

 

in this example

I'd like to distinctcount the Brand without the filter combination [Category] = NO and ([Day Segment] = Weekday and [Day Segment] = Weekend).

screenshot.PNG

Here Brand A, E and G should not be counted because these contain the filters above.

So only B, C, F and H should be counted, result would be 4.

My Measure didn't work out

themescreenshot.PNG

 

 
5 REPLIES 5
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

If you've fixed the issue on your own please kindly share your solution. if the above posts help, please kindly mark it as a solution to help others find it more quickly. If not, please kindly elaborate more. thanks!

 

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

 

Create a measure

 

DC =

var _filterTable = FILTER('Table','Table'[Category] <> "No" && 'Table'[Segment] IN {"Weekend","Working Day"})

RETURN
CALCULATE(DISTINCTCOUNT('Table'[Brand]),_filterTable)

 

1.jpg

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

Anonymous
Not applicable

Thank you guys

what I'd like to have furthermore, is a chart also with "NO" on x-axis.

For example Brand H should be displayed and counted as NO in the chart. The chart is filtered by Weekend.

Is it possible to enhance the measure, so we can see the count of Brands, which are "No" and "Weekend" and not "NO" and "Working Day"?

 

screenshot.PNG

 

 

 

Hi @Anonymous ,

 

 

Create a new measue.

 

NoandWeekend =

var _filterTable = FILTER('Table','Table'[Category] = "No" && 'Table'[Segment] IN {"Weekend"})

RETURN
CALCULATE(DISTINCTCOUNT('Table'[Brand]),_filterTable)
 
 
1.jpg
 
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
tex628
Community Champion
Community Champion

The filter statement in the end looks incorrect! 

Change it to,

Filter(Table, OR(AND([Category] = "NO" , [Day Segment] = "Weekend") , AND([Category] = "NO" , [Day Segment] = "Working Day")))


Br,
J


Connect on LinkedIn

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.