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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
PSB
Helper III
Helper III

DAX to count values based on condition

I need count column.

for same values in "Category" column, for example fruits but there are three different type of fruits in Product column, I need count as 3.

In vegetable, there are two raws with category "Vegetable" but  in Product there is only one type of vegetable (Eggplant), I need count to be 1.

 

Product

CategoryCount
AppleFruits3
AppleFruits3
PinapleFruits3
BananaFruits3
EggplantVegetable1
EggplantVegetable1
3 ACCEPTED SOLUTIONS
vicky_
Super User
Super User

Try the following:

Count Column = CALCULATE(DISTINCTCOUNT(Product), ALLEXCEPT(Category))

 

View solution in original post

I get this error. could you please share exact formula?

Too many arguments were passed to the DISTINCTCOUNT function. The maximum argument count for the function is 1.

PSB_0-1677016324180.png

 

View solution in original post

Column = CALCULATE(DISTINCTCOUNT('Table'[Product]),ALLEXCEPT('Table','Table'[Category]))

View solution in original post

4 REPLIES 4
PSB
Helper III
Helper III

found the issue

 

vicky_
Super User
Super User

Try the following:

Count Column = CALCULATE(DISTINCTCOUNT(Product), ALLEXCEPT(Category))

 

I get this error. could you please share exact formula?

Too many arguments were passed to the DISTINCTCOUNT function. The maximum argument count for the function is 1.

PSB_0-1677016324180.png

 

Column = CALCULATE(DISTINCTCOUNT('Table'[Product]),ALLEXCEPT('Table','Table'[Category]))

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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