Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ethel
Creator III
Creator III

Pivot table formula for subtotal

How to write formula for subtotal in pivot table, so it will be specific only for one subtotal based on subsub total name?

Thanks a lot in advance!

 

1 Solution

Accepted Solutions
rubenmarin

Hi, first try to set an expression with just "=Dimensionality()" to confirm wich dimesinality has the row, probably it would be '2', and the expression may be something like:

If(Dimensionality()=2 and [CategoryFieldName]='Category1'
  ,Sum({<[SubCatFieldName]={'SubCat3'}>} Value) // custom subtotal
  ,Sum(Value) // other normal subtotals
)

 

View solution in original post

4 Replies
rubenmarin

Hi, you can use "Dimensionality()" to identify the subtotal row, and you'll need an additional "If" to check the value you want to use the customized subtotal.

At the end the expression coul be like:

If(Dimensionality()=1 and FieldValue='TheCustomized'
  ,Sum(CustomValue) // custom subtotal
  ,Sum(Value) // other normal subtotals
)
Ethel
Creator III
Creator III
Author

Thank you very much @rubenmarin !!!

If my data looks like this, what should be my formula for Category1(numbers should come from SubCat3) and should I make any adjustments for Category? Should I do anything about Subgroups1/2? 

Thank you very much in advance!!!!

    Nov Dec
    Group1 Group2 Group3 Group4
    Subgroup1 Subgroup2 Subgroup3 Subgroup4 Subgroup5 Subgroup6 Subgroup7 Subgroup8
                   
Category   11 12 13 14 15 16 17 18
  Category1 9 10 11 12 13 14 15 16
  SubCat1 0.5 1.5 2 2 2 3 3 2
  SubCat2 0.5 0.5 1 2 3 3 4 6
  SubCat3 9 10 11 12 13 14 15 16
  Category2 2 2 2 2 2 2 2 2
  SubCat1 1 1 1 1 1 1 1 1
  SubCat2 1 1 1 1 1 1 1 1
rubenmarin

Hi, first try to set an expression with just "=Dimensionality()" to confirm wich dimesinality has the row, probably it would be '2', and the expression may be something like:

If(Dimensionality()=2 and [CategoryFieldName]='Category1'
  ,Sum({<[SubCatFieldName]={'SubCat3'}>} Value) // custom subtotal
  ,Sum(Value) // other normal subtotals
)

 

Ethel
Creator III
Creator III
Author

Thank you so much!!!