An interesting Power Query nugget for you: you can compare two tables using the Value.Equals() function. For example, take the following worksheet with five Excel tables on it:
The following Power Query query compares Table 1 with each of the other four tables and tells me whether they are identical or not:
let
Table1 = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Table2 = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
Table3 = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
Table4 = Excel.CurrentWorkbook(){[Name="Table4"]}[Content],
Table5 = Excel.CurrentWorkbook(){[Name="Table5"]}[Content],
Output = Table.FromRows(
{
{"Table2", Value.Equals(Table1, Table2)},
{"Table3", Value.Equals(Table1, Table3)},
{"Table4", Value.Equals(Table1, Table4)},
{"Table5", Value.Equals(Table1, Table5)}
},
{"Compared Table", "Is Equal ToTable 1"}
)
in
Output
All the code here is doing is loading the five Excel tables and then outputting a single table that shows the result of Value.Equals() when you compare the first table with the other four. Here’s the output:
I’ve tested…
Ursprünglichen Post anzeigen 151 weitere Wörter
Kommentar verfassen