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
I have a complex Power Query formula which determines my columns based on the week number we are in.
It basically looks at the week I am in and gets the columns for 2 weeks before the current week and 5 weeks after the current week.
So today it will bring back Columns 3, 4, 5, 6, 7, 8, 9 and 10 Next week it will bring back 4, 5, 6, 7, 8, 9, 10 and 11
I am now trying to write a formula that add a certain amount on to each column
Written normally the formula would be
(([4]/2)*10)
but that [4] will change to [5] next week and so on.
How do I write something that can change the column based on the week I am in?
You can do this something like:
= Table.TransformRows(PreviousStep, each _ & Record.TransformFields(_, List.Zip({List.Range(Record.FieldNames(_), <start index>, <end index or null for the end>), each _ / 2 * 10})))
That is:
For each row, modify it with (Table.TransformRows):
Hi @SiGill1979 ,
Do you want to select dynamic columns from source table or calculate a result from dynamic columns?
sorry, Im not getting what do you exactly want and how do you see desired output, but i already hae a question. why dont you just multiply to 5? like [4]*5, why ([4]/2)*10 ?
do not hesitate to give a kudo to useful posts and mark solutions as solution
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 |
|---|---|
| 9 | |
| 9 | |
| 8 | |
| 8 | |
| 6 |