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
hksl
Helper I
Helper I

Count (Distinct): DAX equivalent or rename table header

I have table visualization with 2 columns. First column: "State", another column should be number of clubs  for each state.

There is field in table "Club_Number". When I use right-click-on-Club_Number and select "Count (Distinct)" I get correct number of clubs for each state and column header "Count of Club_Number". I need different column header, for examle "Number of Clubs".

But:

- I don't see option to reame header, is there way to re-name header ?

- when I try to create measure it gives me different-wrong number of clubs, same for each state.

   Measure is: DISTINCT('MYTABLE'[CLUB_NUMBER])

   What is the DAX statement for "Count (Distinct)" (which shows up in popup menuon right-btn-click) ?

 

Many thanks

1 ACCEPTED SOLUTION

@hksl

 

In this scenario, since you want to calculate the distinct count within each State, you should have your calculation group on "State". Please use formula like:

 

Number of Clubs:=CALCULATE(DISNTICTCOUNT('MY TABLE'[CLUB_NUMBER]),ALLEXCEPT('MY TABLE','MY TABLE'[State]))

 

Regards,

 

View solution in original post

5 REPLIES 5
BhaveshPatel
Community Champion
Community Champion

Hi @hksl

 

There is no option to rename the table headers.

 

In your case, You should create a neW measure, which will allow you to customize your header.

 

Number of Clubs:=DISNTICTCOUNT('MY TABLE'[CLUB_NUMBER])

 

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Thank you, but   Number of Clubs:=DISNTICTCOUNT('MY TABLE'[CLUB_NUMBER])   does not work.

It seems to produce sum of club numbers ?

 

State                 Count of CLUB_NUMBER            Number of Clubs

CA                           933                                              2733

CO                             41                                              2733

FL                                 8                                             2733

. . .                             . . .                                                . . . 

@hksl

 

In this scenario, since you want to calculate the distinct count within each State, you should have your calculation group on "State". Please use formula like:

 

Number of Clubs:=CALCULATE(DISNTICTCOUNT('MY TABLE'[CLUB_NUMBER]),ALLEXCEPT('MY TABLE','MY TABLE'[State]))

 

Regards,

 

Hi @hksl

 

You have applied my formula in calculated column but the formula is for the measure calculation. This is the reason you are getting unexpected results. Practically, Both your distinct count steps and my DAX formula are same aggregations and it must show the same result. I tried and tested.

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Thank you, but Number of Clubs =DISNTICTCOUNT('MY TABLE'[CLUB_NUMBER])   does not work.

I get one big number for 'Number of Clubs' for each row, sum of clun numbers ?

 

State         Count of CLUB_NUMBER      Number Of Clubs

CA                       933                                    2673

CO                        41                                     2673

FL                           8                                     2673

. . .                        . . .                                       . . .

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.