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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
BharatM
New Member

DAX - counting based on two columns

Hi,

 

I am fairly new to DAX. I have been struggling all day to solve a particular problem and would be grateful if someone can help guide me. I have a list of customers and data looks like this (dummy example):

 

Customer IDChoice
101Desk
101Chair
101Chair
102Chair
102Chair
103Desk
104Desk
104Chair
105Chair
105Chair
105Desk
105Chair
106

Desk

 

Eash customer can have multiple entries. However I want to extract only the ID of those customer who have chosen "Chair" only and nothing else - in this example 102 and 106. I have scratched my head and tried different thing and have failed. 

 

Thank you.

 

Bharat

1 ACCEPTED SOLUTION

@BharatM

 

I would suggest creating either a calculated column or measure using this code:

Chair only =
IF (
    CALCULATE (
        SELECTEDVALUE ( Choices[Choice] ),
        ALLEXCEPT ( Choices, Choices[Customer ID] )
    )
        = "Chair",
    1
)

Then apply a visual level filter (or any sort of filter in the case of a calculated column) Chair only = 1


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

View solution in original post

4 REPLIES 4
harakuruku
Helper I
Helper I

Create a calculated column

 

IsChair = IF(Table1[Choice] = "Chair", 1, 0)

 

Then sum it in the display

Will this not also count those customer IDs who have chair and desk or table? I want only those customers who have chair and nothing else as a selection.

@BharatM

 

I would suggest creating either a calculated column or measure using this code:

Chair only =
IF (
    CALCULATE (
        SELECTEDVALUE ( Choices[Choice] ),
        ALLEXCEPT ( Choices, Choices[Customer ID] )
    )
        = "Chair",
    1
)

Then apply a visual level filter (or any sort of filter in the case of a calculated column) Chair only = 1


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

I can't thank you enough!!!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.