Forum Discussion

Ingan's avatar
Ingan
Regular Visitor
2 years ago
Solved

Create calculated table from multiple tables with sum and group by DAX

Hi,

I have a problem that i´ve been struggling with.

I want to create a preaggregated calculated table from 1 fact table and 2 dimensions.

 

Fact

FactKeyAccountAmountCostCenterId
1351001022334
23400020066789
39322030066789
49322015066789

 

DimReport

ReportReportRowAccount
Rapport129129/* CM35100
Rapport129129/* CM34000
Rapport129129/* CM93220

 

DimCostCenter

CostCenterIdCostCenterName
22334xy
66789op

 

My desired output in calculated table is this:

 

 

 

 

 

I have tried with ADDCOLUMNS and SUMMARIZE but i only manage to get columns from one dimension and sum of fact columns. I want to have columns from 2 dimensions( Report and CostCenter) and sum of fact columns.

  • Tutu_in_YYC's avatar
    Tutu_in_YYC
    2 years ago

    also try this:

    Table =

        SUMMARIZE(
            Fact,
            DimReport[Report],
            DimReport[Account],
            DimCostCenter[CostCenterName],
            "SumAmount", SUM(Fact[Amount])
        )

3 Replies

    • Tutu_in_YYC's avatar
      Tutu_in_YYC
      Super User

      also try this:

      Table =

          SUMMARIZE(
              Fact,
              DimReport[Report],
              DimReport[Account],
              DimCostCenter[CostCenterName],
              "SumAmount", SUM(Fact[Amount])
          )
    • Ingan's avatar
      Ingan
      Regular Visitor

      Thank you so much for your reply! Yes i realize im in the wrong section 🙂 Im working with a tabular model in Visual studio so i can´t access the Power Query editor.