Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
shiveshsingh
Master
Master

Need below table with required conditions - Qlik Sense

Hi Guys

Need your help here. Please check below table.

   

Sr. NoMonthDMU NamesLocationABCDE
1AUGKeralaIndia10232235
2AUGDelhiIndia124525567
3AUGNoidaIndia2653
4AUGLucknowIndia643
5AUGDelhiIndia1367254
6AUGDelhiIndia6823
7AUGLucknowIndia146323
8AUGKeralaIndia177233598
9AUGNoidaIndia1933254
10AUGKeralaIndia203439

Through this table, i need below table

ProductAugBenchmark
A230
B330
C130
D230
E3

30

Here bench mark should be editable and dynamic and logic for getting the values below Month(AUG) is

lets take eg for A, so here '2' signifies the count of DMUs whose sum(A) is greater than benchmark.(Kerala and Noida)

Please help, and i don't have license as of now, so kindly help with the expressions and script as well.

17 Replies
shiveshsingh
Master
Master
Author

Thanks but this is not working,

I need these A, B,C,D,E in dimension ( Product..using crosstable)

and then count(DMU) where sum of values in A column is greater than 'Benchmark'.

something like this..

select count(DMU) where  (sum(Product) group by DMU) > Benchmark.

Product   Data

A               2 ( As sum of A for  kerala and Noida is greater than 30)

jyothish8807
Master II
Master II

Hi Shivesh,

Use the same expression:

count(Aggr(If(sum(Data) >=30,[DMU Names]),[DMU Names],Product))

And do a cross table and create a field "Product", then you can use "Product as your dimension.

Some thing like this:

INPUTFIELD Benchmark;

A:

CrossTable(Product, Data, 4)

LOAD [Sr. No],

     Month,

     [DMU Names],

     Location,

     A,

     B,

     C,

     D,

     E

FROM

(ooxml, embedded labels, table is Sheet1);

NoConcatenate

B:

Load *,

rowno() as Benchmark;

Load

// [Sr. No],

     Month,

     [DMU Names],

     Location,

     Product,

     Sum(Data)as Data

Resident A

group by

// [Sr. No],

     Month,

     [DMU Names],

     Location,

     Product,

     ;

    

        

Drop table A;

Capture.PNG

Best Regards,
KC
shiveshsingh
Master
Master
Author

Thanks Jyothish

I also need below rows while calculation, how this can be possible?

  

ProductAug Benchmark
A230
B330
TotalAB5
C130
D230
TotalCD3
E3 30
jyothish8807
Master II
Master II

Try like this, if you know the product grouping:

A:

CrossTable(Product, Data, 4)

LOAD [Sr. No],

     Month,

     [DMU Names],

     Location,

     A,

     B,

     C,

     D,

     E

FROM

(ooxml, embedded labels, table is Sheet1);

NoConcatenate

B:

Load *,

rowno() as Benchmark;

Load

// [Sr. No],

     Month,

     [DMU Names],

     Location,

     Product,

     Sum(Data)as Data

Resident A

group by

// [Sr. No],

     Month,

     [DMU Names],

     Location,

     Product,

     ;

concatenate (B)

  Month,

     [DMU Names],

     Location,

    if( Product ='A' or Product='B','Total AB'............) as Product,

     Sum(Data)as Data

Resident A

group by

// [Sr. No],

     Month,

     [DMU Names],

     Location,

     Product,

Load

       

Drop table A;

Br,

KC

Best Regards,
KC
jyothish8807
Master II
Master II

Check this: Seems to be working for me:

sort:

LOAD * INLINE [

    Product

    A

    B

    Total AB

    C

    D

    Total CD

    E

    Total E

];

INPUTFIELD Benchmark;

Load

'' as Benchmark

AutoGenerate 1;

A:

CrossTable(Product, Data, 4)

LOAD [Sr. No],

     Month,

     [DMU Names],

     Location,

     A,

     B,

     C,

     D,

     E

FROM

(ooxml, embedded labels, table is Sheet1);

NoConcatenate

B:

//Load *,

//

//'' as Benchmark;

Load

// [Sr. No],

     Month,

     [DMU Names],

     Location,

     Product,

     Sum(Data)as Data

Resident A

group by

// [Sr. No],

     Month,

     [DMU Names],

     Location,

     Product,

     ;

Concatenate (B)

//

//Load *,

//

//'' as Benchmark;

Load

  Month,

     [DMU Names],

     Location,

    if( Product ='A' or Product='B','Total AB',if(Product ='C' or Product='D','Total CD','Total E')) as Product,

     Sum(Data)as Data

Resident A

group by

// [Sr. No],

     Month,

     [DMU Names],

     Location,

     Product;

Drop table A;

Drop table sort;

Capture.PNG

exp1:count(Aggr(If(sum(Data)>=Benchmark,[DMU Names]),[DMU Names],Product,Data))

exp2: Inputsum(Benchmark)

Br,

KC

Best Regards,
KC
jyothish8807
Master II
Master II

Pfa sample as well.

Best Regards,
KC
shiveshsingh
Master
Master
Author

Can we use set expression instead of multiple if in expression?

shiveshsingh
Master
Master
Author

And also can u explain the expression also..cz i need to incorporate condition like benchmark is different for every product.