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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
krichmond
Helper IV
Helper IV

Is there a way to add a row at the bottom of a table where that row simply does distinct counts?

Is there a way to add a row at the bottom of a table (sample of it below) where that row simply distinct counts the number of "Work Orders" and "Spoken Keys"? This row would need to live at the bottom of the data in the table (sample of it below).

 

Sample Of New Report Without Distinct Counts:

Screenshot 2022-12-06 121653.png

 

Sample Of Existing Report With Distinct Counts:

Screenshot 2022-12-06 121955.png

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@krichmond You would have to construct measures like this:

Measure 2 = IF(HASONEVALUE(Table3[Work Order]),MAX([Work Order]),COUNTROWS(DISTINCT(ALL('Table3'[Work Order])))&"")


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@krichmond You would have to construct measures like this:

Measure 2 = IF(HASONEVALUE(Table3[Work Order]),MAX([Work Order]),COUNTROWS(DISTINCT(ALL('Table3'[Work Order])))&"")


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler - I tried exporting the data in the table into Excel but those values didn't carry over. Is there a way for those values to carry over into an Excel export?

@Greg_Deckler - So we figured out the export piece. Sorry to ping you with that. I am seeing that the counts are coming back inaccurate, but they are just a few off. Not sure what is causing this. A link to sample data is here:

 

 

The "Work Order" count should have a distinct count of 155 and the "Spoken Key" count should have a distinct count of 161. Right now it is coming over as 156 for the "Work Order" and 166 for the "Spoken Key".

 

Also, if possible without messing anything up, is there a way to have the distinct counts automatically adjust to filters that are applied to the report? I tried filtering the report and noticed that the numbers stayed static with the adjusting data set.

 

Based on all of this, are you able to tell what is driving this variance between the actuals and the calculated results? Sorry for the question, very new to DAX and still trying to learn it on the fly. I appreciate your help so far.

@krichmond Here is a guess. Trailing spaces and other white space, use Trim and Clean operations to remove anything like that. One other thing to keep in mind. For Power BI data models, the model is in "ignore case" mode. So HBJ24B is the same as hBJ24b is the same as hbj24b is the same as HBj24B, you get the idea. So just something to be aware of when dealing iwth distinct counts of alphanumeric values.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors