Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. 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
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |