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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
krishnagutha1294
Partner - Contributor II
Partner - Contributor II

Percentage calculation

Hi all

Need to calculate Percentage for products. 

I have one field called Product in that i have valves like Apple, Banana,Grapes,Mango.

I want to calculate Percentage for each product for based on Month.

For Example Sum(Product)=10000 In that Sum(Apple)=3000,Sum(Banana)=4000,Sum(Grapes)=2000,Sum(Mango)=1000

Let assume this data belongs 6 months  now need to calculate percentage for each Product valve

Product Valve= Each Month valve/Sum(Product Valve)

Pls can any one help me how to write expression for this case.

 

Thanks in Advance

12 Replies
krishnagutha1294
Partner - Contributor II
Partner - Contributor II
Author

Pls can any one respond

Vegar
MVP
MVP

I did not really understand your question, but I give it a try. 

Consider this data set:

LOAD Product, Monthname(Month) as Month ,Amount inline [
Product,Month,      Amount
Apple,  2020-08-01, 3000
Banana, 2020-08-01, 4000
Grapes, 2020-08-01, 2000
Mango,  2020-08-01, 1000
Apple,  2020-07-01, 5000
Banana, 2020-07-01, 6000
Grapes, 2020-07-01, 2000
Mango,  2020-07-01, 1000
Apple,  2020-06-01, 9000
Banana, 2020-06-01, 7000
Grapes, 2020-06-01, 2000
Mango,  2020-06-01, 1000
];

Is the image below close to your desired output or is it something else? Please explain.

Vegar_0-1596611919163.png

 

 

krishnagutha1294
Partner - Contributor II
Partner - Contributor II
Author

Thanks for responding.

What i am looking is not this, The output should be like below attached file.

Thank You

krishnagutha1294
Partner - Contributor II
Partner - Contributor II
Author

Kindly can any one respond it Please.

Vegar
MVP
MVP

Using this datamodel

 

LOAD Product, Monthname(Month) as Month ,Amount inline [
Product,Month,      Amount
Apple,  2020-08-01, 3000
Banana, 2020-08-01, 4000
Grapes, 2020-08-01, 2000
Mango,  2020-08-01, 1000
Apple,  2020-07-01, 5000
Banana, 2020-07-01, 6000
Grapes, 2020-07-01, 2000
Mango,  2020-07-01, 1000
Apple,  2020-06-01, 9000
Banana, 2020-06-01, 7000
Grapes, 2020-06-01, 2000
Mango,  2020-06-01, 1000
];

 

You can use this expression.

 

sum( Amount)/sum(Total <Product> Amount)

Vegar_0-1596620079246.png

 

 

krishnagutha1294
Partner - Contributor II
Partner - Contributor II
Author

How can we show same results in pivot table.

Pls help me

Vegar
MVP
MVP

There should not be any issues using the expression in a pivot table as a measure.

The image below is from QlikView, but it will work similarly in QS.Vegar_0-1596623627067.png

 

Vegar
MVP
MVP

Vegar_0-1596623983710.png

See attached qvf

 

krishnagutha1294
Partner - Contributor II
Partner - Contributor II
Author

I have used above expression in my case its showing below result

This one is before selection of month

Before Selection.png

After selection the month the result is like below, Pls help me how to resolve the issue

After Selection.png