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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Help set analysis

Hi all,

for each three-month period I have 3 possible date: 01/31, 02/29, 03/30.

Without filtering data I would have sum(VALORE_MAG) for the max(date) of each period (year, threemonth period)

DATA INVENTARIO= date

ANNO= year

TRIMESTRE= three month period

This expression is not correct because it extracts the maximum date throughout the period, not the quarter

sum({<[DATA INVENTARIO]={'$(=Max([DATA INVENTARIO]))'}, ANNO,TRIMESTRE>}VALORE_MAG)

Cattura1.JPG

for each T# i would like to have a value (valore trim mag) that is the value for the max(date) of the quarter.

How can I do that without filter data?

Cattura2.JPG

Thank you to all!

1 Solution

Accepted Solutions
vincent_ardiet
Specialist
Specialist

Hi,

Try this (if the quarter is in the dimension of your chart) :

sum ({$<DATA INVENTARIO={'$(=concat(aggr(max(DATA INVENTARIO),MESE),chr(39)&','&chr(39)))'}>} VALORE_MAG )

Regards,

Vincent

View solution in original post

5 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Try to aggr data by Anno and trimestre before sum ...

Anonymous
Not applicable
Author

Thanks, how can i write it?

aggr(sum({<[DATA INVENTARIO]={'$(=Max([DATA INVENTARIO]))'}>}VALORE_MAG),ANNO,TRIMESTRE)

doesn't work...

vincent_ardiet
Specialist
Specialist

Hi,

Try this (if the quarter is in the dimension of your chart) :

sum ({$<DATA INVENTARIO={'$(=concat(aggr(max(DATA INVENTARIO),MESE),chr(39)&','&chr(39)))'}>} VALORE_MAG )

Regards,

Vincent

Anonymous
Not applicable
Author

It works! Thank you!!!

Could you explain me what do you do with $(=concat(aggr(max(DATA INVENTARIO),MESE),chr(39)&','&chr(39)))'?

vincent_ardiet
Specialist
Specialist

As you have quarters in dimensions, aggr(max(DATA INVETARIO), MESE) will return 3 values, the last day of each month of the current quarter.

Then, I concatenate the 3 values but I want them to be separated by a single quote (ascii code 39), a coma (',') and another quote.

So I'm composing a string like 'month1','month2','month3' (the opening and closing quotes are before the $ and before the }).

Regards,

Vincent