Forum Discussion
Comparing two columns in the same table (uneven rows)
- Anonymous5 years ago
Hi Anonymous
According to the scenario you mentioned, I created a simple sample, you can refer to my steps .
(1)I import two excels (data 1 and data 2) to desktop .The numbers of rows in the two excels are different .
(2)I extract a column from a table with fewer rows to create a new table .
Table = SELECTCOLUMNS('data 1',"ID",'data 1'[ID])(3)Use LOOKUPVALUE() to extract the columns compared from two data tables into the new table .
Value 1 = LOOKUPVALUE('data 1'[Value],'data 1'[ID],'Table'[ID]) Value 2 = LOOKUPVALUE('data 2'[Value],'data 2'[ID],'Table'[ID])(4)Create a calculated column to return the judgment value.
W-L = IF('Table'[Value 1]>'Table'[Value 2],"Won","Loss")The final result is as shown :
Notice : The column ID in the new table I created here is extracted from the table with fewer rows, so the ID is only displayed to 10. You can come according to your own ideas .
I have attached my pbix file ,you can refer to it .
Best Regards
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
According to the scenario you mentioned, I created a simple sample, you can refer to my steps .
(1)I import two excels (data 1 and data 2) to desktop .The numbers of rows in the two excels are different .
(2)I extract a column from a table with fewer rows to create a new table .
Table = SELECTCOLUMNS('data 1',"ID",'data 1'[ID])
(3)Use LOOKUPVALUE() to extract the columns compared from two data tables into the new table .
Value 1 = LOOKUPVALUE('data 1'[Value],'data 1'[ID],'Table'[ID])
Value 2 = LOOKUPVALUE('data 2'[Value],'data 2'[ID],'Table'[ID])
(4)Create a calculated column to return the judgment value.
W-L = IF('Table'[Value 1]>'Table'[Value 2],"Won","Loss")
The final result is as shown :
Notice : The column ID in the new table I created here is extracted from the table with fewer rows, so the ID is only displayed to 10. You can come according to your own ideas .
I have attached my pbix file ,you can refer to it .
Best Regards
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.