Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi!
I have the following code
let
Origen = Table.Combine({Unico2020, Unico2021}),
#"Filas filtradas" = Table.SelectRows(Origen, each ([Titolare] = "Empresa")),
#"Tipo cambiado" = Table.TransformColumnTypes(#"Filas filtradas",{{"Inizio Coll", type date}}),
#"Columna condicional agregada" = Table.AddColumn(#"Tipo cambiado", "orden_estado", each if [Stato] = "CONSUNTIVATO" then 1 else if [Stato] = "VERIFICA DOCUMENTALE" then 2 else 3),
#"Filas ordenadas" = Table.Sort(#"Columna condicional agregada",{{"Inizio Coll", Order.Ascending}, {"orden_estado", Order.Ascending}, {"Avviso", Order.Ascending}}),
#"Duplicados quitados" = Table.Distinct(#"Filas ordenadas", {"Fornitore"})
in
#"Duplicados quitados"
I expected to keep the first unique value of the column "Fornitore", since I previously ordered by "Inizio Coll", "orden_estado" and "Avviso", which are the fields that give me a priority in the data to keep.
However I have come across records that do not meet that criteria.
Can someone tell me that I am doing wrong that I do not have the first record that meets my order criteria?
Thanks,
Federico
Solved! Go to Solution.
Hi @fedeleu,
Can you try adding Table.Buffer(PreviousStep), immediately before the Table.Distinct step?
Let me know if this improves the results for you.
Regards,
Kim
| Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
Hi @fedeleu,
Can you try adding Table.Buffer(PreviousStep), immediately before the Table.Distinct step?
Let me know if this improves the results for you.
Regards,
Kim
| Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
That worked!
Thank you very much!!!
Can you explain me what Table.Buffer does?
It stores the table in memory preventing that step from being evaluated again. Typically used for performance improvements.
I think the reason this is needed in the sorting/distinct scenario is best explained in this post...
https://exceleratorbi.com.au/remove-duplicates-keep-last-record-power-query/
| Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 10 | |
| 9 | |
| 7 | |
| 5 | |
| 5 |