Forum Discussion

kenbie0126's avatar
kenbie0126
Regular Visitor
9 years ago
Solved

Create a Martrix which sum several row in a table

    Date  Main Value Assist 1 Value Assist 2 Value 01/04/2017 A  £  500.00 B  £  100.00 C  £  100.00 01/03/2017 B  £  600.00 B  £  200.00 C  £  100.00 01/08/2017 C  ...
  • Anonymous's avatar
    Anonymous
    8 years ago

    hi kenbie0126

     

    I did it the following way.

     

    1. Create a summarized table called MainValues -  SUMMARIZE(MultiRow,,MultiRow[MainValue]).

        This will create unique MainValue from the factable - MultiRow and will act as a dimension table.

     

    2.  Using Manage Relationship create relationship between MainValues and MultiRow

          a) on Columns MainValue from both the tables

          b) on column MainValue from MainValue and MultiRow[Assist1]

          c)  on column MainValue from MainValue and MultiRow[Assist2]

         Note only (a) will be active and others will not  be active.

     

    3.  Create measures

         a)  SumTot1 = CALCULATE(SUM(MultiRow[Value]))

        

         b) SumTot2 = CALCULATE(SUM(MultiRow[Value2]),USERELATIONSHIP(MainValue[MainValue],MultiRow[Assist1]))

     

         c)  SumTot3 = CALCULATE(SUM(MultiRow[Value3]),USERELATIONSHIP(MainValue[MainValue],MultiRow[Assist2]))

     

         d)  SumTot = [SumTot1] + [SumTot2] + [SumTot3] 

     

    4. Now create a matrix table using

        a)  MainValue [MainValue] as Columns

        b)  MultiRow[Date] as Rows

        c)  [SumTot] as  Values.

     

    Note : replace MutilRow table with your Facttable name and Value, Value2, Value3 columns with your fact table column names.

     

    Sample output

     

     

    If this works for you please accept it as a solution and also give KUDOS.

     

    Cheers

     

    CheenuSing