Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello Everyone
I have created my report which get the data from SSAS (Import Method),
And i Want to add one more row to the results and this row has a calculated values from the other rows.
Can i do that in the Advanced editor ?
This's My Columns :
let Source = AnalysisServices.Database(".", "gs1olap", [TypedMeasureColumns=true, Implementation="2.0"]), GeneralLedger1 = Source{[Id="GeneralLedger"]}[Data], GeneralLedger2 = GeneralLedger1{[Id="GeneralLedger"]}[Data], #"Added Items" = Cube.Transform(GeneralLedger2, { {Cube.AddAndExpandDimensionColumn, "[Accounts]", {"[Accounts].[ID].[ID]"}, {"Accounts.ID"}}, {Cube.AddAndExpandDimensionColumn, "[AccountType]", {"[AccountType].[Account Type].[Account Type]"}, {"AccountType.Account Type"}}, {Cube.AddAndExpandDimensionColumn, "[Basis]", {"[Basis].[Basis].[Basis]"}, {"Basis.Basis"}}, {Cube.AddAndExpandDimensionColumn, "[Chart Of Accounts]", {"[Chart Of Accounts].[Parent Node Id].[Level 02]", "[Chart Of Accounts].[Parent Node Id].[Level 03]", "[Chart Of Accounts].[Parent Node Id].[Level 04]", "[Chart Of Accounts].[Parent Node Id].[Level 05]", "[Chart Of Accounts].[Parent Node Id].[Level 06]"}, {"Chart Of Accounts.Level 02", "Chart Of Accounts.Level 03", "Chart Of Accounts.Level 04", "Chart Of Accounts.Level 05", "Chart Of Accounts.Level 06"}}, {Cube.AddAndExpandDimensionColumn, "[Cost Centers]", {"[Cost Centers].[ID].[ID]"}, {"Cost Centers.ID"}}, {Cube.AddAndExpandDimensionColumn, "[JE Type]", {"[JE Type].[JE Type].[JE Type]"}, {"JE Type.JE Type"}}, {Cube.AddAndExpandDimensionColumn, "[Posting Status]", {"[Posting Status].[Posted].[Posted]"}, {"Posting Status.Posted"}}, {Cube.AddAndExpandDimensionColumn, "[Related to sales]", {"[Related to sales].[Relatedto Sales].[Relatedto Sales]"}, {"Related to sales.Relatedto Sales"}}, {Cube.AddAndExpandDimensionColumn, "[Scenarios]", {"[Scenarios].[Scenario Key].[Scenario Key]"}, {"Scenarios.Scenario Key"}}, {Cube.AddAndExpandDimensionColumn, "[Time]", {"[Time].[Date].[Date]", "[Time].[Month].[Month]", "[Time].[Quarter].[Quarter]", "[Time].[Year].[Year]"}, {"Time.Date", "Time.Month", "Time.Quarter", "Time.Year"}}, {Cube.AddMeasureColumn, "Amount", "[Measures].[Amount]"} }), #"Changed Type" = Table.TransformColumnTypes(#"Added Items",{{"Amount", Currency.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "IncomeStatementAmount", each if [Chart Of Accounts.Level 02] = "Revenue" then [Amount] else if [Chart Of Accounts.Level 02] = "Expenses" then -[Amount] else [Amount]), #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"IncomeStatementAmount", Currency.Type}, {"Time.Date", type date}}) in #"Changed Type1"
And the New row which i want to add has this values :
Solved! Go to Solution.
Hi @Abdalmoamen
Calculated columns or measures would not show in query editor, so we can’t use them to create columns.
An alternative way is to add custom column replacing the calculated columns/measures, then use the values from these columns to add rows.
For example, calculating sum of a column can be achieved by this formula in query editor
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.Sum(Table.SelectRows(#"Changed Type", each [Scenarios.Scenario Key]="Actual")[Amount]))
As for adding rows to exisiting columns, we can use these functions.
However, since it needs to create custom columns to replace calculated columns or measures, it would be complex.
Best Regards
Maggie
Hi @Abdalmoamen
Calculated columns or measures would not show in query editor, so we can’t use them to create columns.
An alternative way is to add custom column replacing the calculated columns/measures, then use the values from these columns to add rows.
For example, calculating sum of a column can be achieved by this formula in query editor
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.Sum(Table.SelectRows(#"Changed Type", each [Scenarios.Scenario Key]="Actual")[Amount]))
As for adding rows to exisiting columns, we can use these functions.
However, since it needs to create custom columns to replace calculated columns or measures, it would be complex.
Best Regards
Maggie
User | Count |
---|---|
103 | |
87 | |
78 | |
71 | |
69 |
User | Count |
---|---|
113 | |
99 | |
97 | |
72 | |
68 |