Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago

Row Totals for a pivot table

I have a Pivot table with the following columns: Responses, 0 to 3 , 4 to 6, 7 to 9, 10.

For each response in my pivot I have totals under each column. I would like to get a total per response for all the numbers under each column. 

For example:

response     0 to 3     4 to  6  7 to 9  10

child care       2            13        5        2       total = 22

 

The underlined total is what I am looking to get. 

 

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    If the responce is a measure like one measure for '0 to 3' one for '4 to 6', etc. then create new measure the sums up the other measures on the columns and add to matrix

  •  

    • Go to the Data view or Model view.

    • Click on the table where your pivot data is located.

    • In the ribbon, select Modeling and then New Measure.

    • Enter a formula like this:

      DAX
      Total Responses = SUM('YourTableName'[0 to 3]) + SUM('YourTableName'[4 to 6]) + SUM('YourTableName'[7 to 9]) + SUM('YourTableName'[10])

      Make sure to replace 'YourTableName' with the actual name of your table.

    • After creating the measure, add it to your pivot table or visual, and it will display the total for each response.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      The problem with it is the I pivot on the field 'distress scores'. In that field is the 0 to 3, 4 to 6, etc. So I cannot do it before pivotting, I dont believe. When I try after its pivotted, I get the error message ' can only sum on a column reference'.

      I am at a total loss!

  • Anonymous's avatar
    Anonymous
    Not applicable

    Here is an example created like you just explained. The row is Year, the Value is a measure(RS Sales = SUM(SaleAMount) and the column is Category (like your 0 to 3, etc.)
    I created a matrix from scratch (blank), added RS Sales to Values, Year to ROws and CategoryName to columns

     




  • Not sure the data needs to be pivoted. 

    If the data is unpivoted and you have two columns A is 0..10 and B is number of responses for each of A. 

    Sum(Column B)

    Would need to see the original table?  If the above assumption is incorrect.

    Onwards and Upwards!