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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
shippen70
Helper I
Helper I

Summarize Table and Remove Duplicates

I am working with a table of data that I am trying to summarize.  For development I am using New Table and Summarizing.  I get the first level of summary to work but my table ends up with some duplicate values.  Ultimately I want to count the rows that remain after summarizing and removing the duplicate.  My Row Count should be 1 for every row.  The other option would be to replace the values that are greater than "1" with "1".  Any thoughts how I can remove these duplicates without having to setup the table in Power Query?

Operation Count by Day =

SUMMARIZE('_AELaborEdit - Clock In Date',
'_AELaborEdit - Clock In Date'[ClockInDate],
'_AELaborEdit - Clock In Date'[Job],
'_AELaborEdit - Clock In Date'[Operation],
"Operations Count",
COUNTROWS('_AELaborEdit - Clock In Date')
)
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@shippen70 .

Try distinct(Table)

or in case summarize group by what you distinct first and take measure with rename post that.

You can use table inplace of summarize

countrows(

SUMMARIZE('_AELaborEdit - Clock In Date',
'_AELaborEdit - Clock In Date'[ClockInDate],
'_AELaborEdit - Clock In Date'[Job],
'_AELaborEdit - Clock In Date'[Operation],
"Operations Count",
COUNTROWS('_AELaborEdit - Clock In Date'))

or

countx(

SUMMARIZE('_AELaborEdit - Clock In Date',
'_AELaborEdit - Clock In Date'[ClockInDate],
'_AELaborEdit - Clock In Date'[Job],
'_AELaborEdit - Clock In Date'[Operation],
"Operations Count",
COUNTROWS('_AELaborEdit - Clock In Date')
)
), [Operations Count])

 

https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@shippen70 .

Try distinct(Table)

or in case summarize group by what you distinct first and take measure with rename post that.

You can use table inplace of summarize

countrows(

SUMMARIZE('_AELaborEdit - Clock In Date',
'_AELaborEdit - Clock In Date'[ClockInDate],
'_AELaborEdit - Clock In Date'[Job],
'_AELaborEdit - Clock In Date'[Operation],
"Operations Count",
COUNTROWS('_AELaborEdit - Clock In Date'))

or

countx(

SUMMARIZE('_AELaborEdit - Clock In Date',
'_AELaborEdit - Clock In Date'[ClockInDate],
'_AELaborEdit - Clock In Date'[Job],
'_AELaborEdit - Clock In Date'[Operation],
"Operations Count",
COUNTROWS('_AELaborEdit - Clock In Date')
)
), [Operations Count])

 

https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks for the reply.  When I try to add the COUNTROWS before the Summarize I get an error:

"The expression specified in the query is not a valid table expression"

When I try to use COUNTX it will not allow me to reference back to  the "Operations Count" Coulmn created in the summarize.

Any additional thoughts?

I put the expression provided by @amitchandak into DaxFormatter.com.  It was just missing the last ")".

 

NewMeasure =
COUNTROWS (
SUMMARIZE (
'_AELaborEdit - Clock In Date',
'_AELaborEdit - Clock In Date'[ClockInDate],
'_AELaborEdit - Clock In Date'[Job],
'_AELaborEdit - Clock In Date'[Operation],
"Operations Count", COUNTROWS ( '_AELaborEdit - Clock In Date' )
)
)

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


I had corrected the braket issue but still get the same result.  Based on  @amitchandak input to countrows again  I just created a second Measure to count the table rows again.  I achived what I was trying to.  Thanks

ryan_mayu
Super User
Super User

@shippen70 

please share the sample date and the expected output.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors