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
amty63
Helper III
Helper III

Incorrect totals in Table View when using DISTINCTCOUNT Function power BI desktop

Hello,

Total is reflecting incorrect in table view when using DISTINCTCOUNT function in DAX.

Test1 = DISTINCTCOUNT('Participants'[ Participant Id])

 

amty63_0-1618756578805.png

 

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

Hi @amty63 ,

You could create a new measure:

test2 = IF(HASONEVALUE('Participants'[COUNTRY_DESCR]),[Test1], SUMX(ALL('Participants'),'Participants'[Test1]))

 

final you will see the below:

v-luwang-msft_0-1618884851928.png

 

 

Wish it is helpful for you!

 

Best Regards

Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @amty63 ,

You could create a new measure:

test2 = IF(HASONEVALUE('Participants'[COUNTRY_DESCR]),[Test1], SUMX(ALL('Participants'),'Participants'[Test1]))

 

final you will see the below:

v-luwang-msft_0-1618884851928.png

 

 

Wish it is helpful for you!

 

Best Regards

Lucien

jdbuchanan71
Super User
Super User

@amty63 

The total row in a visual showing a DISTINCTCOUNT does not add up the rows above.  I caluclates the DISTINCTCOUNT without any filter applied to the country_descr.  You must also have some other filters / slicers that are feeding into that visual.  
If you want the total to add up by country you can do something like this.

Participants by country =
SUMX (
    VALUES ( TableName[COUNTRY_DESCR] ),
    CALCULATE ( DISTINCTCOUNT ( 'Participants'[ Participant Id] ) )
)

You will need to change the 'TableName' to match whatever table your [COUNTRY_DESCR] is in.

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.