# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for
Did you mean:
Highlighted
Not applicable

## Difference and variance formulas in KPI

Hello, im incorporating in the subtitle and footnote of a KPI (that is comparing the sell of units between one year and another) the difference (quantity) and variance (% change) of the two figures presented. Im using the next formulas to calculate difference and variance, but unfortunately they are not working:

='DIF = '& NUM((NUM(Median({\$<AÑO={\$(=max([AÑO]))}>}[Margen VI]),'#')-NUM(Median({\$<AÑO={\$(=max([AÑO])-1)}>}[Margen VI]),'#')),'#,#0')

='VARIACIÓN = '& NUM((([MARGEN 4 N]-[MARGEN 4 N-1])/[MARGEN 4 N-1]),'#,#%')

If anyone could help me regarding this issue I will really appreciated as im knew in Qlik Sense.

1 Solution

Accepted Solutions
Highlighted
MVP

## Re: Difference and variance formulas in KPI

May be try this

='DIF = '& Num(Median({\$<AÑO={\$(=Max([AÑO]))}>} [Margen VI]) - Median({\$<AÑO = {\$(=Max([AÑO])-1)}>} [Margen VI]), '#,#0')

This looks good if MARGEN 4 N and MARGEN 4 N-1 will always only have single values

='VARIACIÓN = ' & Num((([MARGEN 4 N]-[MARGEN 4 N-1])/[MARGEN 4 N-1]), '#,#%')