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: 
Not applicable

Problem with max(date) in a chart

Hello

I met an problem i explain you,

I want to sum an indicator for every month only at the max(date_chargement) of the month wich is not always the same with the end of the date of the calendar month.

Date_chargement is an field wich permit us to know the date of the loading…

My dimension is the month ….

I ve try two expression in an chart but I don’t know why it doesn’t work.

1)  First expression

Sum({$<Division={$(=TxtSociété)},
         
Year={$(=vYearMax)},,Month=,Période=,[date_chargement]={">=$(=Max([date_chargement]))   <=$(=Max([date_chargement]))"}>}[Indicateur])

This expression give an result only for the current month and as you can look under nothing for the others months.


2)  Second expression

Sum({$<Division={$(=TxtSociété)},
         
Year={$(=vYearMax)},Month=,Période=,[date_chargement]={">=$(=Max([Date]))   <=$(=Max([Date]))"}>}[ Indicateur])

Is somebody could help me to fix this problem..

Thanks

3 Replies
its_anandrjs
Champion III
Champion III

Try first statement like

Sum({$<Division={$(=TxtSociété)},
         
Year={$(=vYearMax)},Month=,Période=,[date_chargement]={">=$(=Max([date_chargement]))   <=$(=Max([date_chargement]))"}>}[Indicateur])



alexandros17
Partner - Champion III
Partner - Champion III

at first

[date_chargement]={">=$(=Max([date_chargement]))   <=$(=Max([date_chargement]))"

is equivalent to

[date_chargement]={"$(=Max([date_chargement])"} but the real problem is that

Max([date_chargement])is the max among ALL your [date_chargement] values.

To resolve the question you have to compute max for each month in the script (with a left join on the key) assigning a flag to max value for each month.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Set analysis expressions calculate a set for the entire chart, not per row (or column in your pivot table). You'll have to use if statements instead. Perhaps something like sum({<.....>} if(Date = aggr(max(date_changement),Month),[Indicateur],0))


talk is cheap, supply exceeds demand