模型数据源 - Power BI
Model data source - Power BI
我正在尝试在 power bi 中为数据源建模,但我没有得到它。
你能帮我找到替代方案吗,这样我就可以创建一个新专栏了?数据源在 excel 中,并按类型(XPTO、XPT 等)带来带有小计的数据。我想将这些类型作为相应的值放在您的项目的新列中。我尝试通过 power query 和 dax,但我不能。
原始出处:
需要修改
这假设您可以通过检查第一列中第一个 space 的位置来识别小计行:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Added RowType" = Table.AddColumn(Source, "RowType", each Text.PositionOf([#"Centro financ./item orçamento"]," "), Int64.Type),
#"Added Type" = Table.AddColumn(#"Added RowType", "Type", each if [RowType] = 4 then Text.BetweenDelimiters([#"Centro financ./item orçamento"], " ", " ") else null, type text),
#"Filled Down" = Table.FillDown(#"Added Type",{"Type"}),
#"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([RowType] = 8)),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"RowType"}),
#"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",List.Combine({{"Type"}, Table.ColumnNames(Source)}))
in
#"Reordered Columns"
另一个解决方案是 - 在 Power BI 中包含另一个数据源,它看起来像这样。
Item Type
615x92120 Mat1 XPTA
615x92121 Mat2 XPTA
615x92122 Mat3 XPTU
615x92123 Mat4 XPTU
然后在您现有的 table 和此 table 之间进行连接,以在您现有的 table 中显示类型。一旦你这样做了,你应该能够过滤掉空白或空,这将是你的删除行。
注意:- 这仅在您事先知道所有项目和相应类型的情况下才有效。
我正在尝试在 power bi 中为数据源建模,但我没有得到它。
你能帮我找到替代方案吗,这样我就可以创建一个新专栏了?数据源在 excel 中,并按类型(XPTO、XPT 等)带来带有小计的数据。我想将这些类型作为相应的值放在您的项目的新列中。我尝试通过 power query 和 dax,但我不能。
原始出处:
需要修改
这假设您可以通过检查第一列中第一个 space 的位置来识别小计行:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Added RowType" = Table.AddColumn(Source, "RowType", each Text.PositionOf([#"Centro financ./item orçamento"]," "), Int64.Type),
#"Added Type" = Table.AddColumn(#"Added RowType", "Type", each if [RowType] = 4 then Text.BetweenDelimiters([#"Centro financ./item orçamento"], " ", " ") else null, type text),
#"Filled Down" = Table.FillDown(#"Added Type",{"Type"}),
#"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([RowType] = 8)),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"RowType"}),
#"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",List.Combine({{"Type"}, Table.ColumnNames(Source)}))
in
#"Reordered Columns"
另一个解决方案是 - 在 Power BI 中包含另一个数据源,它看起来像这样。
Item Type
615x92120 Mat1 XPTA
615x92121 Mat2 XPTA
615x92122 Mat3 XPTU
615x92123 Mat4 XPTU
然后在您现有的 table 和此 table 之间进行连接,以在您现有的 table 中显示类型。一旦你这样做了,你应该能够过滤掉空白或空,这将是你的删除行。
注意:- 这仅在您事先知道所有项目和相应类型的情况下才有效。