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

Qlikview query

hi all

I need to calculate difference of count of previous quarter and current quarter plz check the below attachment

 

thanks

Labels (2)
6 Replies
luiferva
Contributor III
Contributor III

Hola Sol_26

lo que entendi que necesitas, es la diferencia de conteo de productos por periodo

por ejemplo el conteo del producto A en el periodo uno menos el conteo del producto A del periodo dos.

Consegui este resultado

luiferva_1-1658989541828.png

Utilize la siguiente expresión de grafico

aggr(sum({<Period={'2020Q1'}>}[Count of type])-sum({<Period={'2020Q2'}>}[Count of type]),Product)

Si logre ayudarte por favor regalame un like , estoy atento a tu consulta, Feliz dia 😀

Sunil_26
Contributor II
Contributor II
Author

hi thanks how to make it as dynamic quarter instead of static

sidhiq91
Specialist II
Specialist II

@Sunil_26  Please see the expression below:

Aggr(Sum({<Period={'2020Q2'}>}[Count of type])-Sum({<Period={'2020Q1'}>}[Count of type]),Product)

This expression is pretty much hard coded based on your period. But we can make it dynamic.

Let me know if you need any help on that.

Also, Addition of Period to the table would be very irrlevant.

Sunil_26
Contributor II
Contributor II
Author

hi @sidhiq91  i want period to be changed every time so i need period to be dynamic instead of static

sidhiq91
Specialist II
Specialist II

@Sunil_26  Then you need to provide me some detailed data. Which has dates in it. Then it will help me to work on it and provide you a better solution.

luiferva
Contributor III
Contributor III

Hola Sol_26

Siempre necesitas comparar el periodo actual con el anterior?

si es asi podrias primeramente, renombrar tu campo Period y quitarle el Q de la siguiente forma, esto para que quede un valor numerico y poder utilizar la funcion de agragación Max

T:
LOAD Period, 
     Product, 
     Type, 
     [Count of type],
     PurgeChar(Period,'Q') as #Period
FROM
[..\..\..\coalesce.xlsx]
(ooxml, embedded labels, table is Hoja1);

despues guardar tu maximo periodo y el periodo anterior en variables

luiferva_0-1659017195211.png

Finalmente utilizas esas variables en tu expresión de grafico

aggr(sum({<#Period={$(MaxPeriod)}>}[Count of type])-sum({<#Period={$(MinPeriod)}>}[Count of type]),Product)

Resultado

luiferva_1-1659017312484.png