Forum Discussion

ringovski's avatar
ringovski
Icon for Helper II rankHelper II
3 years ago
Solved

Matrix Table Static Sub Totals

Hi All,

I would like to add a row to matrix table thats shows the total Value$ for each column which ignores any product code number filter selected. So you can compare the sum of selected codes numbers against the total of all the product codes no matter which product codes you select. 

 

All data is in one fact table, there a dimension table for each SK with unique values.

 

Table name Export_Fact_Codes_All

 

calendar_sk country_sk loading_sk discharge_sk product_code_sk state_sk quantity_sk value$
30010016001211 4001 328967  
30010116011212 600 84353905  
30010226031212 800 41839
30110016001212 900 12888454  
30110126011213 1000 27880729  
30110226021213 200 230237  

 

Current Matrix Table

 

Year

Product_Code

  2005

  Value$

  2006

  Value$

121  
         country1001328967 12888454 
         country10184353905 27880729 
         country10241839  230237
         Total85724711 40999420  
       Total_All_Product_Codes   xxxxxxxx  xxxxxxxx  

 

As per normal behaviour the sub totals changes when I select different product codes. However I would like the sum of the value$ for all products no matter what i select in product_code silcer (Dim_Product_Code), Total_All_Product_Codes.

 

I've tried a new column in the fact table;

Total = IF(ISINSCOPE(Dim_Product_Code[product_code]),

                          SUM(Export_Fact_Codes_All[value$]),

                         CALCULATE(SUM(Export_Fact_Codes_All[value$]),All(Export_Fact_Codes_All)

                     )

               )

 Measure;

Total = CALCULATE(SUM(Export_Fact_Codes_All[value$]),All(Export_Fact_Codes_All)

 

Hopefully this is clear, Thanks for any assistance.

 

  • ringovski I hope this helps you. Thank You.

    compare Total Value =
    CALCULATE([Total Value],ALL('Table A'))

     

3 Replies

    • ringovski's avatar
      ringovski
      Icon for Helper II rankHelper II

      Hopefully this is enough information and clear. It's the same as Values 'show on rows' option but only for one measures the Total_All_Product_Codes.

       

      Matrix Table, my expected results is the total sum of all product codes in the last row without any filters being applied as 'Total_All_Product_Codes'.

       

      Year

      Product_Code

        2005

        Value$

        2006

        Value$

      121  
               country1001328967 12888454 
               country10184353905 27880729 
               country10241839  230237
               Total85724711 40999420  
             Total_All_Product_Codes   xxxxxxxx  xxxxxxxx  

       

      I have the expected result in a measure however it appears as column and repeats for every row. So obviously not right.

       

      Total_All_Product_Codes = Calculate(SUM(Export_Fact_Codes_All[value$]),                           

                                       ALL(Dim_Product_Code)

                                      ))

      • Mahesh0016's avatar
        Mahesh0016
        Icon for Super User rankSuper User

        ringovski I hope this helps you. Thank You.

        compare Total Value =
        CALCULATE([Total Value],ALL('Table A'))