powerbi - 从在不同列 Power BI 或 Excel 中具有多行的列中移动多个值
解决方案
在 Power BI 中,您可以在Power Query 编辑器中执行一些转换以实现所需的输出。
让,您的表结构和示例数据如下所示 -
现在,转到您的表格的高级编辑器并将代码替换为以下代码 -
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("PcdJDoAgEETRu/TaSyCoKDjPEu5/Dbs0qcVP/ktJjBTitENy8avSTqrWLqrRbsprz6dSr9WMITuwJANoyQg6sgcrcgDrj1Z3BBtyAj05gy25gB25goHcwEjuYC85vw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [col1 = _t, col2 = _t, col3 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"col1", type text}, {"col2", type text}, {"col3", type text}}),
//--New Transformation starts from here
#"Grouped Rows" = Table.Group(#"Changed Type", {"col1"}, {{"grouped", each _, type table [col1=nullable text, col2=nullable text, col3=nullable text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each [grouped][col2]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each [grouped][col3]),
#"Extracted Values" = Table.TransformColumns(#"Added Custom1", {"Custom", each Text.Combine(List.Transform(_, Text.From), ";"), type text}),
#"Extracted Values1" = Table.TransformColumns(#"Extracted Values", {"Custom.1", each Text.Combine(List.Transform(_, Text.From), ";"), type text}),
#"Removed Columns" = Table.RemoveColumns(#"Extracted Values1",{"grouped"})
in
#"Removed Columns"
这是最终的输出 -
推荐阅读
- python - dymola.readTrajectory - 不同的采样时间
- android - 使用 fileTransfer 下载 Ionic 4
- python - 如何将 random.seed 与 random.randn 一起使用?
- jenkins - 在 Jenkins 上存储文件(不在凭证中)
- sas - 提取在 TWS 中安排的作业中使用的大型机数据集
- android - Android Studio - 重新打开项目后出现很多错误
- qt - Qt Creator 以不同的配置运行 CMake
- javascript - Classlist.add 以更短的方式?
- javascript - 为什么 export * 和 import * 在 ES2015 模块中的工作方式不同
- git - 用于 CMD 和 VS 的单独 GIT 差异和合并工具