Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

A subtotal in a table

Hello,

I would like to create in a table a subtotal on a population category. And a total on the whole population. With a peculiarity on the percentages as the following tableundertotal.JPG

thanks you for your help

1 Solution

Accepted Solutions
Kushal_Chawda

Age:

LOAD Age,

    Customer,

    if(Match(slice,'70 ans and more','60-70 years','50-60 years','40-50 years','30-40 years','0-30 years'),'Know',

    if(slice='Unknow','Unknow')) as Group,

    if(Match(slice,'70 ans and more','60-70 years','50-60 years','40-50 years','30-40 years','0-30 years'),slice) as Know_Slice,

    if(slice='Unknow',slice) as Unknow_Slice,

    slice

FROM

[Age.xlsx]

(ooxml, embedded labels, table is Sheet1);

Sort:

LOAD * Inline [

Know_Slice,Sort

70 ans and more,6

60-70 years,5

50-60 years,4

40-50 years,3

30-40 years,2

0-30 years,1 ];

Dim:

LOAD * Inline [

Dim

1

2

3

4 ];

Create Straight table

Dimension:

=Pick(Dim,Know_Slice,'Under Total',Unknow_Slice,'Total')

=Pick(Dim,

Count(Customer)/Count( total Customer),

Count({<Group={'Know'}>}Customer)/Count(total Customer),

Count(Customer)/Count(total Customer),

Count(Customer)/Count(total Customer))

Sort Expression:

=Pick(Dim,Sort,8,9,10)

Capture.JPG

View solution in original post

12 Replies
prat1507
Specialist
Specialist

Hi

Can u plz share a sample app.

Regards
Pratyush

Anil_Babu_Samineni

May be this?

Sum(Number)/Sum(TOTAL Number)

OR

Sum(Number)/Sum(TOTAL <Dimension1> Number) //Dimension1 is nothing but your Dimensions

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

hello,

A sample app

Thanks

prat1507
Specialist
Specialist

HI

PFA the app with the calculations.


Regards
Pratyush

Anonymous
Not applicable
Author

Thanks but i need a subtotal for these catégories

categorie.JPG

Anil_Babu_Samineni

One simple way, May be this?

Count(Customer) / Count(TOTAL {<slice -= {Unknow}>} Customer)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
PrashantSangle

Hi,

Enhancing Pratysh reply.

Convert straight table into pivot table

add calculated dimension as

=if(WildMatch(slice,'0-30 years','30-40 years','40-50 years','50-60 years','60-70 years','70 ans and more'),'Group1',slice)

then go to presentation > select Always Fully Expanded.

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
devarasu07
Master II
Master II

Hi,

By using If Valuelist method you can able achieve desired output. please check the sample app attached (you have to change the values based on yours).

ValueList() – For those tricky situations

Missing Manual - ValueLoop() &amp; ValueList()

Kushal_Chawda

Age:

LOAD Age,

    Customer,

    if(Match(slice,'70 ans and more','60-70 years','50-60 years','40-50 years','30-40 years','0-30 years'),'Know',

    if(slice='Unknow','Unknow')) as Group,

    if(Match(slice,'70 ans and more','60-70 years','50-60 years','40-50 years','30-40 years','0-30 years'),slice) as Know_Slice,

    if(slice='Unknow',slice) as Unknow_Slice,

    slice

FROM

[Age.xlsx]

(ooxml, embedded labels, table is Sheet1);

Sort:

LOAD * Inline [

Know_Slice,Sort

70 ans and more,6

60-70 years,5

50-60 years,4

40-50 years,3

30-40 years,2

0-30 years,1 ];

Dim:

LOAD * Inline [

Dim

1

2

3

4 ];

Create Straight table

Dimension:

=Pick(Dim,Know_Slice,'Under Total',Unknow_Slice,'Total')

=Pick(Dim,

Count(Customer)/Count( total Customer),

Count({<Group={'Know'}>}Customer)/Count(total Customer),

Count(Customer)/Count(total Customer),

Count(Customer)/Count(total Customer))

Sort Expression:

=Pick(Dim,Sort,8,9,10)

Capture.JPG