Forum Discussion
Anonymous
4 years agoNot applicable
Add new calculated column with values from 2 tables (Power Query)
Hello all, I'm really new to Power BI and Power Query and I am now struggling with the following: Imagine we have Table1 and Table2, which can link by the column "Name": Table1 Nam...
- 4 years ago
Hi Anonymous ,
Try adding this as a new custom column in Table2:
let currentName = [Name], meters = Table.SelectRows(Table1, each [Name] = currentName){0}[Produced Meters] in meters / [Run Time]This gives me the following output:
Pete
AlexisOlson
4 years agoSuper User
It's certainly possible to do this in one step (see BA_Pete's answer) but you should be aware that such a solution is less efficient than a multi-step approach of merging in the column and then dividing.
Merge-then-divide should be a linear complexity O(N) whereas an unoptimized lookup-then-divide is likely quadratic complexity O(N2). If your dataset is large this can make a huge difference.
Anonymous
4 years agoNot applicable
Thank you. I will take this into account and use Merge-then-divide