英文:
Power Query multiply column using variable column name from excel range
问题
我有问题涉及Power Query中的一行代码:我想要添加一个新列,将我的表格中的一个现有列乘以2。
对我来说,这里的难点是,我将要乘以2的列是由同一Excel工作表中的单元格值定义的。
我的问题是:如何添加一个新列,知道现有列的引用是由一个单元格值给出的?
我尝试了类似这样的代码,但不起作用:
#“添加FAT” = Table.AddColumn(#“添加YEAR”, “FAT (g/100 g)”, each Excel.CurrentWorkbook(){[Name=“Fat_variable”]}[Content][Colonne1]{0}*2)
谢谢大家!
英文:
I'm having problems with a code line in Power Query : I want to add a new column multiplying by 2 one existing column of my table.
The difficulty for me here is that the column that I will multiply by 2 will be defined by a cell value contained in the same Excel worksheet.
My question is : how can I add a new column knowing that the reference of the existing column is given by a cell value?
I'm trying something like this, but not working :
#"Add FAT" = Table.AddColumn(#"Add YEAR", "FAT (g/100 g)", each Excel.CurrentWorkbook(){[Name="Fat_variable"]}[Content][Colonne1]{0}*2)
Thank you all !!
答案1
得分: 2
尝试
#"添加脂肪" = Table.AddColumn(#"添加年份", "脂肪 (g/100 g)", each Record.Field(_,Excel.CurrentWorkbook(){[Name="Fat_variable"]}[Content]{0}[Column1])*2)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论