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

Announcements
Note: You may notice some temporary visual or styling issues in the Community. Our vendor is actively investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
Mayron
Contributor III
Contributor III

Comparar Valor do Mes Anterior com o Atual

Bom dia,

Estou com uma dúvida, preciso obter valor em % de um determinado valor, comparando o mês atual com o anterior.

Tenho uma grafíco de barra onde estou apresentando a Empresa e o Valor Gasto por mês.

Grupo: AnoMes

Barras: Empresa

Medida: Valor

Gostaria de apresentar nesse mesmo gráfico uma comparação com o mês anterior, Ex: Em relação ao mês anterior, houve um aumento de 5% nos custos.

 

Desde já agradeço muito.

Labels (2)
2 Solutions

Accepted Solutions
MatheusC
Specialist II
Specialist II

Atual / Anterior

Sum(valor) / Above(sum(valor))

 

% acima dos 100% (Crescimento)

 

Sum(valor) / Above(sum(valor))-1

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!

View solution in original post

Qrishna
Master
Master

Say you have data as:


data:
load * inline [
YearMonth,Value
2024-Jan, 10
2024-Feb,20
2024-Mar,20
2024-Apr,40
2024-May,20
2024-Jun,25
2024-Jul,15
2024-Aug,60
2024-Sep,50
];

 

2492113 - Compare Previous Month's Value with Current Month's Value.PNG

Dim:YearMonth
Measure1: CurrMonth =sum(Value)
Measure2: PrevMonth = if(isnull(Above(Sum(Value))), 0, Above(Sum(Value)))
Measure3: % =Num((PrevMonth-CurrMonth)/PrevMonth, '##.##%')

View solution in original post

7 Replies
MatheusC
Specialist II
Specialist II

@Mayron ,
Experimente usar a função above para os meses anteriores a sua medida. Para obter o percentual % basta fazer a divisão da medida atual e anterior.

Above(sum(SuaMedida))


https://help.qlik.com/en-US/sense/May2024/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecor...


- Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
Mayron
Contributor III
Contributor III
Author

Boa Tarde Matheus, 

Os valores pra mim ficaram divergentes ou fiz algo errado, segue print dos resultados.

Mayron_0-1731352361899.png

 

Mayron
Contributor III
Contributor III
Author

Segue uma outra print pra conseguir visualizar melhor o que eu quero dizer, a porcentagem deveria ser a diferente entre o mesm atual e anteior, está dando quase 100% de diferença.

Mayron_0-1731352704993.png

 

MatheusC
Specialist II
Specialist II

Atual / Anterior

Sum(valor) / Above(sum(valor))

 

% acima dos 100% (Crescimento)

 

Sum(valor) / Above(sum(valor))-1

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
Qrishna
Master
Master

Say you have data as:


data:
load * inline [
YearMonth,Value
2024-Jan, 10
2024-Feb,20
2024-Mar,20
2024-Apr,40
2024-May,20
2024-Jun,25
2024-Jul,15
2024-Aug,60
2024-Sep,50
];

 

2492113 - Compare Previous Month's Value with Current Month's Value.PNG

Dim:YearMonth
Measure1: CurrMonth =sum(Value)
Measure2: PrevMonth = if(isnull(Above(Sum(Value))), 0, Above(Sum(Value)))
Measure3: % =Num((PrevMonth-CurrMonth)/PrevMonth, '##.##%')

Mayron
Contributor III
Contributor III
Author

Boa Tarde,

Maravilha, deu tudo certo, muito obrigado.

Mayron
Contributor III
Contributor III
Author

Boa Tarde,

Maravilha, deu tudo certo, muito obrigado.