Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

vlakeshr
Contributor

Re: How can add "If and" condition in pivot table in Qliksense

4th formula

If (Client_type=Individual and country = 'A', (Sum(VALUES)-(value))/sum(VALUES),

If (Client_type=Individual and country = 'B', (Sum(VALUES)-(value))/sum(VALUES),

NULL()))

I used above formula in pivot table but I am getting negative values in % column, that is not correct. somebody help me to fix that issue ..I want to  fix this issue in the next 48 hours.

Awiting Solution on  this error..

Thanks in advance for quick response

19 Replies

Re: How can add "If and" condition in pivot table in Qliksense

Would you be able to share a sample to visualize your issue?

vlakeshr
Contributor

Re: How can add "If and" condition in pivot table in Qliksense

Yes..I am using excel data  

Re: How can add "If and" condition in pivot table in Qliksense

That is great, would you be able to share the Excel and if possible also share the expected output?

vlakeshr
Contributor

Re: How can add "If and" condition in pivot table in Qliksense

I have used IF OR condition but I am getting only  % of country and other country showing wrong calculation.

do you want sample data excelsheet

Re: How can add "If and" condition in pivot table in Qliksense

Something to make sense of your question....

vlakeshr
Contributor

Re: How can add "If and" condition in pivot table in Qliksense

where is option for attached?

Re: How can add "If and" condition in pivot table in Qliksense

Check here:

Uploading a Sample

vlakeshr
Contributor

Re: How can add "If and" condition in pivot table in Qliksense

Please find the attached excel sheet. Sheet A and B containing month wise dataTotal_a and Total_b containg total count of data..This is sample template of random data.

Formula for calculation is using as

(Total Value - Value for DE) / Total Value

vlakeshr
Contributor

Re: How can add "If and" condition in pivot table in Qliksense

I have attached the data..

I am using below script

Table_a:

crosstable(Month,Value,5)

LOAD
    DE,
    "FCC 20",
    CATEEGORY,
    "DQ DIM",
    Country,

"42711",

    "42742",

    "42773",

    "42801",

    "42832",

    "42862",

    "42893",

    "42923",

    "42954",

    "42985",

    "43015",

    "43046",

    "43076"


FROM [lib://HK/HK_Sales_1.xlsx]
(ooxml, embedded labels, table is Sheet1);

Total_a:

crosstable(Month,Values,1)

LOAD

    "Total",

    "42711",

    "42742",

    "42773",

    "42801",

    "42832",

    "42862",

    "42893",

    "42923",

    "42954",

    "42985",

    "43015",

    "43046",

    "43076"

FROM [lib://HK/HK_Sales_1.xlsx]

(ooxml, embedded labels, table is a);

Table_b:

crosstable(Month,Value,5)

LOAD
    DE,
    "FCC 20",
    CATEEGORY,
    "DQ DIM",
    Country,

"42711",

    "42742",

    "42773",

    "42801",

    "42832",

    "42862",

    "42893",

    "42923",

    "42954",

    "42985",

    "43015",

    "43046",

    "43076"


FROM [lib://HK/HK_Sales_1.xlsx]
(ooxml, embedded labels, table is Sheet1);

Total_b:

crosstable(Month,Values,1)  -------------- Change the name as BValues instead of Values

LOAD

    "Total",

    "42711",

    "42742",

    "42773",

    "42801",

    "42832",

    "42862",

    "42893",

    "42923",

    "42954",

    "42985",

    "43015",

    "43046",

    "43076"

FROM [lib://HK/HK_Sales_1.xlsx]

(ooxml, embedded labels, table is a);

I am using three tables currently. But visualization part not giving  correct result for calculation in the pivot table.

by using If condition:

If (Client_type=Individual and country = 'A', (Sum(VALUES)-(value))/sum(VALUES),

If (Client_type=Individual and country = 'B', (Sum(VALUES)-(value))/sum(VALUES),

NULL()))

Note: I have change the name of Values in the 2nd table as BValues

Community Browser