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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
_Alex_
New Member

DAX Help: Unique count by row II

Suppose I have a dataset as follows:

 

Car_ID    Owner_Name  Car_Owner_State  Unique_State_Count

1             Adam               FL                         2

1             Bob                  FL                         2

1             Carrie               GA                       2

2             Alex                 NC                        1

2             Bill                   NC                        1

3             Aron                IL                          1

 

What DAX expression would produce the column "Unique_State_Count" above?

 

 

Thank you!

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @_Alex_

Created calculated column

Unique_State_Count1 = CALCULATE(DISTINCTCOUNT(Table1[ Car_Owner_State]),ALLEXCEPT(Table1,Table1[Car_ID]))

4.png

 

Or measure

Measure = CALCULATE(DISTINCTCOUNT(Table1[ Car_Owner_State]),ALLEXCEPT(Table1,Table1[Car_ID]))

 

Best Regards

maggie

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @_Alex_

Created calculated column

Unique_State_Count1 = CALCULATE(DISTINCTCOUNT(Table1[ Car_Owner_State]),ALLEXCEPT(Table1,Table1[Car_ID]))

4.png

 

Or measure

Measure = CALCULATE(DISTINCTCOUNT(Table1[ Car_Owner_State]),ALLEXCEPT(Table1,Table1[Car_ID]))

 

Best Regards

maggie

Zubair_Muhammad
Community Champion
Community Champion

Hi

Try with

Calculate(distinctcount (table1[carownerstate]), allexcept (table1,table1 [car id]))

Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.