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: 
realpixel
Creator
Creator

count distinct and sum

Hello,

Under a part of my board

HMCOUNTCUSTOTRANSPEV
1000CUSTO1TRANS11
1000CUSTO1TRANS11
1000CUSTO1TRANS11
2000CUSTO2TRANS12
3000CUSTO3TRANS22
3000CUSTO3TRANS32
3000CUSTO3TRANS42
4000CUSTO3TRANS51
5000CUSTO4TRANS52
6000CUSTO5TRANS61
6000CUSTO5TRANS61
6000CUSTO5TRANS61
7000CUSTO6TRANS62
8000CUSTO7TRANS61
9000CUSTO8TRANS62

I use [TRANS] like dimenssion and function count(distinct HMCOUNT) (I use count distinct because there are several time the same value is HMCOUNT) to do a sum of [PEV], it's works by [TRANS] but how to divide by the total of [PEV] for all [TRANS]?

I want to do sum of [PEV] by [TRANS] divide by the sum all PEV multiply by 100

8 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try 100*sum(PEV)/sum(total PEV). See attached example.


talk is cheap, supply exceeds demand
realpixel
Creator
Creator
Author

Thank you Gysbert for your assistance.

In your example I need to do a sum total of "count(distinct HMCOUNT)"

I want to have a function like that

100*count(distinct HMCOUNT)/ "by sum total of count(distinct HMCOUNT)"

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Have a look at the attachment.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
realpixel
Creator
Creator
Author

Hello,

Thank you for your assistance, it's works.

I have some questions.

1 - I have a sheet for a specific value and I created a new graphic in new sheet and all sheet are in the same document.

When I select a value from the filter on the first sheet, this selection appears also on the other sheet, how to do that the filter selection is independent?

2 - In the new sheet, I created a graphic sheet with sector graphic, I need to display the pourcentage of each sector on the graphic, how to do? The pourcentage appears in the legend but not on the sectors.

3 - In my graphic sector I have same color for [TRANS] and [CUSTO], how to do to have a different color?

4 - I need to display the result only for some value in the column [TRANS]. I use a filter selection to choice the value but I want to fix some value without to use a filter selection. Have you an idea how to do?

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Ans 1: Yes you can do this with two ways.

                1. You place an event on sheet activation to clear the selection when you go to sheet.

                    Go to sheet properties -> Triggers -> On ActiveSheet Tigger ->  Add -> Selection ->Clear All.

                2. You use the Alternate state. For more info look into Whats new in QlikView 11.qvw in the example folder of your computer.

     Ans 2: I am not sure what you mean to say, please explain in detail with example.

     Ans 3: You can click on '+' sign next to the expression -> Expand that you will find the Background color.

                Type expression like below in definition space.

               if(Field1 = 'ABC',Red(),Yellow())

     Ans 4: For selection few values by default you can use the Set Analysis.

               Assume you want sales only for country india. Then the expression will be.

               Sum({<Country = {"INDIA"}>} Sales)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Ans 1: Yes you can do this with two ways.

                1. You place an event on sheet activation to clear the selection when you go to sheet.

                    Go to sheet properties -> Triggers -> On ActiveSheet Tigger ->  Add -> Selection ->Clear All.

                2. You use the Alternate state. For more info look into Whats new in QlikView 11.qvw in the example folder of your computer.

     Ans 2: I am not sure what you mean to say, please explain in detail with example.

     Ans 3: You can click on '+' sign next to the expression -> Expand that you will find the Background color.

                Type expression like below in definition space.

               if(Field1 = 'ABC',Red(),Yellow())

     Ans 4: For selection few values by default you can use the Set Analysis.

               Assume you want sales only for country india. Then the expression will be.

               Sum({<Country = {"INDIA"}>} Sales)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
realpixel
Creator
Creator
Author

Hello,

Thank you for reply.

find attached the pie chart, I want to display the pourcentage on the chart and not on the legend, on the both if it's possible.

In use [TRANS] and [CUSTO] like dimension but this value appears in the same color, red. It's possible to have a coleur different, one for [TRANS] and other for [CUSTO].

On the first sheet, I have do a mistake, I have the folling board.

HMCONTCUSTOTRANSDATE MOVDATE ENTREE PEV
U6451156CUSTO1SV19/03/201310/01/20132
U6451156CUSTO1SV19/03/201319/03/20132
U2520054CUSTO1SV18/03/201310/01/20131
U2520054CUSTO1SV19/03/201319/03/20131
U7000870CUSTO1SV19/03/201310/01/20132
U7000870CUSTO1SV19/03/201319/03/20132

I use the function =count(distinct HMCONT) to do a sum of column [PEV] result is = 3

But I want PEV 2 = 2 and PEV 1 = 1 the result of the function above must be = 5. Have you an idea to have this result?

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Kindly upload the sample Qvw file.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!