使用 power query 加载数据源时从配置表单元格获取数据

问题描述 投票:0回答:1

我正在加载 Excel 文件。在那里,我想根据另一列的值替换值。新值应从主 Excel 文件的配置工作表上的表格中提取。

有人可以分享一下这个的语法吗,找不到任何东西

let
  ...
  #"DealProbability" = Table.ReplaceValue(#"DealStageIntType", each [Deal probability], 
      each if  [Deal Stage] = 1 then configtable[column name][first row] 
      else if  [Deal Stage] = 2 then 0.5
      else if  [Deal Stage] = 3 then 0.9
      else if  [Deal Stage] = 4 then 0.9
      else if  [Deal Stage] = 5 then 1
      else 0,
      Replacer.ReplaceValue, {"Deal probability"}),
excel powerquery m
1个回答
0
投票

尝试

 let #"DealStageIntType" = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
 #"DealProbability" = Table.ReplaceValue(#"DealStageIntType", each [Deal Probability], 
  each if  [Deal Stage] = 1 then configtable{0}[Column1]
  else if  [Deal Stage] = 2 then 0.5
  else if  [Deal Stage] = 3 then 0.9
  else if  [Deal Stage] = 4 then 0.9
  else if  [Deal Stage] = 5 then 1
  else 0,
  Replacer.ReplaceValue, {"Deal Probability"})
in  #"DealProbability"

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.