Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rafael_gerhardt
Contributor
Contributor

expressoes de grafico tabela dinamica

Estou precisando efetuar cálculos comparativos entre dados de uma mesma dimensão em uma tabela dinâmica, mas não sei como fazê-lo. A tabela 1 do arquivo anexo contém os dados, já a tabela 2 a tabela dinâmica com os cálculos que preciso em amarelo.

Obrigado.

  

Tabela 1
produtoLocalValor
arrozMERCADO14
feijaoMERCADO110
massaMERCADO14
presuntoMERCADO120
queijoMERCADO125
arrozMERCADO23
feijaoMERCADO27
massaMERCADO25
presuntoMERCADO215
queijoMERCADO220
arrozMERCADO33,5
feijaoMERCADO39
massaMERCADO34,5
presuntoMERCADO322
queijoMERCADO325

      

Tabela 2
ProdutoMERCADO1MERCADO2MERCADO3Menor ValorMaior ValorVariação %% M2/M1% M3/M1
arroz433,534133%75%88%
feijao1079710143%70%90%
massa454,545125%125%113%
presunto2015221522147%75%110%
queijo2520252025125%80%100%
1 Solution

Accepted Solutions
sunny_talwar

Change your expression to this:

Pick(Dim,

Sum(Valor),

Min(Valor),

Max(Valor),

Num(Max(Valor)/Min(Valor), '##.%'),

Num(Sum({<Local = {'MERCADO2'}>}Valor)/Sum({<Local = {'MERCADO1'}>}Valor), '##.%'),

Num(Sum({<Local = {'MERCADO3'}>}Valor)/Sum({<Local = {'MERCADO1'}>}Valor), '##.%'))


Capture.PNG

View solution in original post

7 Replies
sunny_talwar

This:

Capture.PNG

Script:

Table:

LOAD * INLINE [

    produto, Local, Valor

    arroz, MERCADO1, 4

    feijao, MERCADO1, 10

    massa, MERCADO1, 4

    presunto, MERCADO1, 20

    queijo, MERCADO1, 25

    arroz, MERCADO2, 3

    feijao, MERCADO2, 7

    massa, MERCADO2, 5

    presunto, MERCADO2, 15

    queijo, MERCADO2, 20

    arroz, MERCADO3, 3.5

    feijao, MERCADO3, 9

    massa, MERCADO3, 4.5

    presunto, MERCADO3, 22

    queijo, MERCADO3, 25

];

Dim:

LOAD * Inline [

Dim

1

2

3

4

5

6

];

Dimensions:

1) produto


2) =Pick(Dim,

Local,

'Menor Valor',

'Maior Valor',

'Variação %',

'% M2/M1',

'% M3/M1')

Expression:

Pick(Dim,

Sum(Valor),

Min(Valor),

Max(Valor),

Num(Max(Valor)/Min(Valor), '##.%'),

Num(Only({<Local = {'MERCADO2'}>}Valor)/Only({<Local = {'MERCADO1'}>}Valor), '##.%'),

Num(Only({<Local = {'MERCADO3'}>}Valor)/Only({<Local = {'MERCADO1'}>}Valor), '##.%'))

Sort order for 2nd dimension

Sort by Expression -> Dim

rafael_gerhardt
Contributor
Contributor
Author

Thank you Sunny T!

But when I put some more data the formulas dont work...

Capturar.PNG

sunny_talwar

Change your expression to this:

Pick(Dim,

Sum(Valor),

Min(Valor),

Max(Valor),

Num(Max(Valor)/Min(Valor), '##.%'),

Num(Sum({<Local = {'MERCADO2'}>}Valor)/Sum({<Local = {'MERCADO1'}>}Valor), '##.%'),

Num(Sum({<Local = {'MERCADO3'}>}Valor)/Sum({<Local = {'MERCADO1'}>}Valor), '##.%'))


Capture.PNG

rafael_gerhardt
Contributor
Contributor
Author

Wow, This is beautifull!!! Thanks Sunny T!

taking advantage of your good will

There is a way to put the expressions between the columns of 'local'? Or a way to personalize the order of the columns regardless the type of data?

where I can learn about these things?

thank you!!!!!

Enviado do meu iPhone

Em 3 de jul de 2016, às 08:48, Sunny T <qcwebmaster@qlikview.com> escreveu:

expressoes de grafico tabela dinamica

reply from Sunny T in Qlik Brasil - View the full discussion

Change your expression to this:

Pick(Dim,

Sum(Valor),

Min(Valor),

Max(Valor),

Num(Max(Valor)/Min(Valor), '##.%'),

Num(Sum({<Local = {'MERCADO2'}>}Valor)/Sum({<Local = {'MERCADO1'}>}Valor), '##.%'),

Num(Sum({<Local = {'MERCADO3'}>}Valor)/Sum({<Local = {'MERCADO1'}>}Valor), '##.%'))

Reply to this message by replying to this email, or go to the message on Qlik Community

Start a new discussion in Qlik Brasil by email or at Qlik Community

Following expressoes de grafico tabela dinamica in these streams: Inbox

© 1993-2016 QlikTech International AB | Copyright & Trademarks | Privacy | Terms of Use | Software EULA

sunny_talwar

Columns of local? Do not understand this, can you elaborate?

With regards to the sort order, you can definitely customize the sort order using a sort order expression. There might be few ways to do this, what exact sort order are you looking for?

rafael_gerhardt
Contributor
Contributor
Author

like this:

ps: this is just an example that I'm using to understande and apply into

more complex data

2016-07-03 12:02 GMT-03:00 Sunny T <qcwebmaster@qlikview.com>:

rafael_gerhardt
Contributor
Contributor
Author

Capturar.PNG