Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

month today

hi,

how do i calculte sum(kg) , for  max month.

exm:

no mather which month i select the callculte will be some kg for the late month & year that i have (=today).

thanks'

yarin.

2 Replies
its_anandrjs

Hi Yarin,

Assume this example which ha Year,Month, Kg values

LOAD Id,Kg,
Date(Date#(Year,'YYYY'),'YYYY') as Year,
Date(Date#(Month,'M'),'M') as Month;
LOAD * Inline
[
Id,Kg,Year,Month
1,200,2011,5
2,150,2013,4
3,18,2014,5
4,1854,2014,8
5,781,2014,12
]
;

Then in the front end if want to sum up Kg for current today() month year value then use this expression in any chart or text box

=sum({<Year={'$(=Year(Today()))'},Month={'$(=Num(Month(Today())))'}   >} Kg)

Or otherwise if want to sum up data for the max date available in the data then write like

=sum({<Year={'$(=Max(Year))'},Month={'$(=Max(Month))'}  >} Kg)

Regards

Anand

preminqlik
Specialist II
Specialist II

you can also try with this one

=sum({<Year={'$(=Max(Year))'},Month={'$(=Max({<Year={'$(=Max(Year))'}>}Month))'} ,Day=,Date= >} Kg)