Forum Discussion
Number of rows - Power Query
- 6 years ago
The 2nd one is also filtering out "Material" while the 1st is not.
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
The query editor is the same between Excel and Power BI. Did you copy the M code from one to the other to make sure they are exactly same (replace M code in Advanced Editor)?
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
- Marialicepg6 years agoNew Member
Hello!
I'll explain better:
I have 2 PowerBi files, and I use csv files to supply them. File 1 is an exact copy of the Excel M code. This file contains the same number of rows as the Excel file. Pbix 2 is not an exact copy of Excel, but it should generate the same number of rows that is generated by the Excel M code, as the applied steps are very similar. The difference is in the number of steps. File 2 is "cleaner", I use fewer steps.
I'll give you an example:
In file 1 I used two steps to filter my table, as shown in the code below:
First: Table.SelectRows(#"Change name", each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null})))
Second: Table.SelectRows(#"Filter applied", each not Text.StartsWith([Material], "MS") and not Text.StartsWith([Material], "S"))
In file 2 I used only one step to filter my table: Table.SelectRows(#"Change name", each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null})) and not Text.StartsWith([Material], "MS") and not Text.StartsWith([Material], "S")and not Text.StartsWith([Material], "Material"))
I tought both codes should generate the same number of rows. But maybe I did something wrong and I cant see it.
- mahoneypat6 years agoMicrosoft Employee
The 2nd one is also filtering out "Material" while the 1st is not.
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
- Marialicepg6 years agoNew Member
The problem was the filter step, indeed.
If I filter everything at once it doesn't work, but if I use 3 steps to filter my collumns it does work.
Anyway, problem solved!
Thanks!
- Icey6 years agoCommunity Support
Hi Marialicepg ,
Is what mahoneypat said the cause of your problem?
And have you checked whether the data after importing Power BI (at the step of #"Changed Type") has changed?
Best regards
Icey
If this post helps, then consider Accepting it as the solution to help other members find it more quickly.