Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis in dimension that is used in table

Hello,

Quite new in Qlikview. I have a dimension "result" with possible values 'sales', 'cost of sales' and 'gross profit'. Another dimension is the Firm name. Now I want to see the  % of each value in the dimension compared to the value when the dimension is Sales. Sum(Saldo)/sum(total Saldo) does not work because then the %

against the total of sales + cost of sales + gross margin is calculated. I have tried with set analysis (SUM(Saldo)/SUM({1<RESULTAAT={"Sales"}>}Saldo)) but this does not work either because then QV calculates only correct for the row where the dimension is indeed 'Sales'.

I hope I make myself clear?! I hoped I could fix the value of the dimension (RESULTAAT = 'SALES')  with set analysis, but it does not seem to work because the dimension itself is used in the pivot table.

   

FirmTotalTotalFirm AFirm AFirm BFirm B
RESULTAATSaldo%Saldo%Saldo%
Sales350 000,00100,00%250 000,00100,00%100 000,00100,00%
Cost of Sales-200 000,00-57,14%-140 000,00-56,00%-60 000,00-60,00%
Gross Margin150 000,0042,86%110 000,0044,00%40 000,0040,00%
9 Replies
sunny_talwar

How about this:

Sum(Saldo)/Sum(TOTAL <Firm> {<RESULTAAT = {'Sales'}>} Saldo)

sunny_talwar

Here is a sample attached

Capture.PNG

Not applicable
Author

Thanks, it works!

I also have another question. The % Omzet expression I have calculated with your help, this calculates the expression for each firm (dimension) in the column seperately. I Also have calculated an expression which calculates the % for all firms, no matter what firm is selected or what firm is shown in dimension (% Totale groep = +Sum( TOTAL <RESULTAAT> {<Firma={"*"}>} Maandcijfer)/SUM(total{<Firma={"*"},RESULTAAT = {'verkopen z btw'}>}Maandcijfer)).

This also works, so for each firm I get the relative figures against sales (verkopen z btw) in column "% Omzet", and in column "% Totale groep" I get the relative figures for the whole group of firms, so I can compare one firm with the average. Now the problem is that when I select 1 firm (firm A hereunder is selected), Firm B is also shown because the expression "% Totale groep" is always active. In what way I can tackle this?

Thanks in advance

        

FirmaTotaalTotaalTotaalFirm AFirm AFirm AFirm BFirm BFirm B
RESULTAATSaldo% Omzet% Totale groepSaldo% Omzet% Totale groepSaldo% Omzet% Totale groep
verkopen z btw3 884 903,76100%100%3 884 903,76100%100%0,00-100%
kostprijs der verkopen-3 039 729,20-78%-78%-3 039 729,20-78%-78%0,00--78%
BRUTOWINST845 174,5622%22%845 174,5622%22%0,00-22%
diverse opbrengsten  xxx57 421,771%1%57 421,771%1%0,00-1%
mali/prijsverlagingen/kaart5 185,240%-1%5 185,240%-1%0,00--1%
sunny_talwar

May be try this (Don't exclude Firma in the numerator)

Sum(TOTAL <RESULTAAT>  Maandcijfer)/Sum(TOTAL {<Firma={"*"}, RESULTAAT = {'verkopen z btw'}>} Maandcijfer)

Not applicable
Author

Thank for your answer. But I'm afraid this is not the solution. When I don't include all firms in the numerator, the % of only the selected firm against de total group is calculated.

sunny_talwar

Is it possible to share a sample with expected output to help you better here?

vinieme12
Champion III
Champion III

it's because of

Sum( TOTAL <RESULTAAT> {<Firma={"*"}>} Maandcijfer)/SUM(total{<Firma={"*"},RESULTAAT = {'verkopen z btw'}>}Maandcijfer))


If you are trying to suppress null values in Firma, simply check suppress null values in your dimension as they are already in your dimensions, null values will be ignored and you can take of this part Firma={"*"} from your calculation.

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Not applicable
Author

Thanks for your answers. 

And it works partially, only the firms (dimension) that are selected (and thus not zero) are shown in the columns but also only these firms (that are selected) are calculated in the total, so the total is not the total of all the firms (because {<Firma={"*"}>} is no longer included.

sunny_talwar

Why is it not included?