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
Gustavo98
Helper V
Helper V

how to detect easily in which step i generated duplicated row in power query

Hi everyone @edhans 

 

I commited a mistake and i generated duplicates rows, how can i detect easily in which step is my problem?

 

Gustavo98_0-1683901600694.png

I would like to see in the image above the real rows number not the 999+.

 

Ty very much

2 ACCEPTED SOLUTIONS
edhans
Super User
Super User

One if the ways to do this inadvertently is with a merge. Say you have data that looks like this in your merge. Notice in the 2nd table the #3 is duplicated:

edhans_0-1683903372834.png

When you merge, it will look like this:

edhans_1-1683903407430.png

But when you expand the merged column, it will look like this, duplicating the records on #3 because there were two of them in the right table.

 

 

edhans_2-1683903458590.png

 

The way to prevent this is to make sure the table on the right side of the join has a 1:1 cardinality with the left table.

There may be other ways to cause this, but merge is the most common.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

BA_Pete
Super User
Super User

Hi @Gustavo98 ,

 

I agree with @edhans , row duplication most commonly happens during merges.

However, to check the row counts at each step, the number at the bottom isn't going to help you.

Select your Navigation step from the APPLIED STEPS list and go to the Transform tab > Count Rows. This will just output a scalar value of your row count as at the prior step.

Then you can just drag and drop your row count step down through the step list to quickly(ish) see the count at each stage.

It's a back of a tedious hack, but probably the quickest and simplest method.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

7 REPLIES 7
BA_Pete
Super User
Super User

 

For future readers, just to crank this up a notch, let's say you have a 100-step query with 40 merges (I know, right!), and you just want to see your row counts change over the entire thing without too much effort. Well then, give this a whizz:

 

-1- Duplicate your query

-2- Open Advanced Editor on your copy and change the 'let' to '[', and your 'in lastStep' to ']'. So:

 

let
    Source = mySource,
    someStuff = doTransformMagic
in
    someStuff

...goes to:

[
    Source = mySource,
    someStuff = doTransformMagic
]

 

 

 

This will convert your query into a record, with each step being its own row, something like this:

BA_Pete_0-1683906647025.png

 

-3- Convert your record into a table and add a custom column that is just = Table.RowCount([Value])

 

Et Voila:

BA_Pete_1-1683906781489.png

 

Then, to update later when new steps are added, you can just copy your current query between let and in, and paste it into your copy between [ and ].

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




This is amazing, ty vry much Pete

BA_Pete
Super User
Super User

Hi @Gustavo98 ,

 

I agree with @edhans , row duplication most commonly happens during merges.

However, to check the row counts at each step, the number at the bottom isn't going to help you.

Select your Navigation step from the APPLIED STEPS list and go to the Transform tab > Count Rows. This will just output a scalar value of your row count as at the prior step.

Then you can just drag and drop your row count step down through the step list to quickly(ish) see the count at each stage.

It's a back of a tedious hack, but probably the quickest and simplest method.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Ty for your answer, nice tip, i was using that but not draging it up or down as you said, this have a lot of sense and will help me to save time

 

TY

 

edhans
Super User
Super User

One if the ways to do this inadvertently is with a merge. Say you have data that looks like this in your merge. Notice in the 2nd table the #3 is duplicated:

edhans_0-1683903372834.png

When you merge, it will look like this:

edhans_1-1683903407430.png

But when you expand the merged column, it will look like this, duplicating the records on #3 because there were two of them in the right table.

 

 

edhans_2-1683903458590.png

 

The way to prevent this is to make sure the table on the right side of the join has a 1:1 cardinality with the left table.

There may be other ways to cause this, but merge is the most common.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Ty vry much, Your explanation is helping me a lot !

Glad I was able to help @Gustavo98 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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.

Top Solution Authors
Top Kudoed Authors