This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
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
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |