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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis

Good afternoon,

I would like to show the balance of the last period selected in my document. I will try to give an example to explain.

Balances:

datebalance
01/01/20121.000,00
02/01/20122.000,00
03/01/20123.000,00

With this data, I would create a text object containing the balance of the last date selected.

If no selections should show 3000.

If you select the dates 01/01/2012 and 02/01/2012 should show 2000.

If you select the dates 01/01/2012 and 03/01/2012 should show 3000.

...

I tried to create a variable that contains the maximum date vMaxDate with definition "= max (date)" and then use an aggregate function follows

Balance = sum ({<date = vMaxFecha> balance}}

How should I do this???

A greeting and thank you very much

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Buenos días,

Me gustaría mostrar el Saldo del último periodo seleccionado en mi documento. Intentaré poner un ejemplo para explicarlo.

Saldos:

fechasaldo
01/01/20121.000,00
02/01/20122.000,00
03/01/20123.000,00

Con estos datos de base, me gustaría crear un objeto de Texto que contenga el saldo de la última fecha seleccionada.

  • Si no hay selecciones debería mostrar 3.000.
  • Si se seleccionan las fechas 01/01/2012 y 02/01/2012 debería mostrar 2.000.
  • Si se seleccionan las fechas 01/01/2012 y 03/01/2012 debería mostrar 3.000.
  • ...

Lo que se me ocurre es crear una variable que contenga la maxima fecha, vMaxFecha con definición "= max(fecha)" y utilizarla después en una función de agregación del siguiente modo

Saldo = sum({<fecha = vMaxFecha>} saldo}

Cómo debería hacer esto???

Un saludo y muchas gracias

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

Hi,

Try this,

=FirstSortedValue(saldo, -fecha)

View solution in original post

4 Replies
MayilVahanan
MVP
MVP

HI

Try like this

=sum({<Date = {'$(=vMaxFecha)'}>}Sales)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thanks for your reply, but it doesn't work in my document.

I have attached the document.

Not applicable
Author

Hi,

Try this,

=FirstSortedValue(saldo, -fecha)

Not applicable
Author

It work's perfect. Thaks a lot.