Forum Discussion
Dynamic Variable in Calculated Columns
- 4 months ago
Step 1) Merge the weights table into your main table
In Power Query, select your main query → Home → Merge Queries → select your weights table → match on the Year column → Join Kind: Left Outer → OK.
Step 2) Expand the merged columns
Click the expand icon on the new merged column → select only the three weight columns (Wage weight, Job Postings weight, Change weight) → uncheck Use original column name as prefix → OK.
Step 3) Replace your custom column formula
Instead of hardcoded values, reference the looked-up weight columns:
= ( [Relative Wage] * [Wage Weight] ) + ( [Relative Job Postings] * [Job Postings Weight] ) + ( [Relative Change] * [Change Weight] )Step 4) Remove the weight columns from the final table if not needed for display
Select the three weight columns → right-click → Remove Columns to keep the output clean.
But keep in mind that:
I can't see your Problem. You have all Columns with the fitting Values in each Row.
Therefore use them.
= Table.AddColumn(Quelle,"Composite Score", each [Relative Wage] * [Wage] + [Relative Jobs] * [Jobs] + [Relative Change] * [Change])Thats meant in the Row for 2023: 0.6 , 0.3 , 0.1
For 2024: 0.5 0.3, 0.2
e.t.c...
Du benutzt also nicht die Spaltenwerte sondern die Spaltennamen zur Berechnung.