Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Not applicable

Finding difference

Hi,

Can someone tell me a way to calculate the difference between two different months that are selected?

I know the way to find and aggregation between two different months but it's hard for me to find a difference.

fx --> GetFieldSelections([ORDER_DT.autoCalendar.Month], ',', 2)

Thank you

Tags (2)
4 Replies

Re: Finding difference

Hi June, maybe looking for the difference between max and min:

Max(DateField)-Min(DateField) --> Would return the difference in days

Or: Month(Max(DateField)) - Month(Min(DateField))

Or: Max([ORDER_DT.autoCalendar.Month]) - Min([ORDER_DT.autoCalendar.Month])

Not applicable

Re: Finding difference

Thanks for the reply,

but I'm actually looking for the difference between SalePrice of two different months.

Thank you

Re: Finding difference

Hi, then you can use set analisys to filter, in example, using a numeric YearMonth field:

Sum({<YearMonth={'$(=Max(YearMonthField))'}>} Sales)-Sum({<YearMonth={'$(=Min(YearMonthField))'}>} Sales)

MVP
MVP

Re: Finding difference

Or this:

FirstSortedValue(Aggr(Sum(Sales), [ORDER_DT.autoCalendar.Month]), -Aggr([ORDER_DT.autoCalendar.Month], [ORDER_DT.autoCalendar.Month])) - FirstSortedValue(Aggr(Sum(Sales), [ORDER_DT.autoCalendar.Month]), Aggr([ORDER_DT.autoCalendar.Month], [ORDER_DT.autoCalendar.Month]))