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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
narender123
Specialist
Specialist

year,month issue?

Hi Team,

i have a problem .I want sum of customs value of Max(Year )  and Max(Month) without any selection on year and month.

But it is not working by default with any selection.It is only working  when i select the year then it takes the max(month)

of that year.

But i want it on without any selection on month and year.

expression i used is:

=sum({<Year={$(=Max(Year))},Month={$(=MaxString(Month))}>}CUSTOMS_VALUE)

please see my attachment file.

Thanks.

Labels (1)
17 Replies
Not applicable

Hi

U can use the below expression

=sum({1<Year={$(=Max(Year))},Month={$(=MaxString(Month))}>}CUSTOMS_VALUE)

Regards,

Kabilan K.

er_mohit
Master II
Master II

sum({<Year={"$(=max(Year))"},Month={"=monthstart(max(Month))"}>}CUSTOMS_VALUE)

narender123
Specialist
Specialist
Author

Thanks Kabilan.

But still same issue.

You can check my attachment

Thanks

narender123
Specialist
Specialist
Author

Thanks Mohit.

But it takes the max year whole month data means up to this month data.

can you please tell me why me expression is not working becuase its the 1st time that this expressuion is not working here.

I have attached qvw .please see it.

Narender

narender123
Specialist
Specialist
Author

Hi all,

Please tell me why my year and month are not working together when i didnt select both year and month.

As shown in my attachment.

?????

Thanks.

Not applicable

Hi Narender,

You could try an easier (in my opinion) approach by using a YearMonth field with a integer value. This field can be very useful in many other situations like creating a chart which shows a trend by YearMonth and you can sort also a Month dimension using this YearMonth field in the Sort tab of the chart object.

Create a YearMonth field like this:

LOAD DECLARATION_ID,

     RECEIPT_DATE,

     Year(RECEIPT_DATE) as Year,

     Month(RECEIPT_DATE) as Month,

     Year(RECEIPT_DATE) * 100 + num(Month(RECEIPT_DATE)) as YearMonth,

     Day(RECEIPT_DATE) as Day,      

     CONSIGNOR_ID,    

     CUSTOMS_VALUE    

FROM

C:\3newreport_QlikviewProject\Development\Data\QVD\DEC_HEADER.qvd

(qvd) where Year(RECEIPT_DATE)<>2212;

and then use this expression:

=sum({<YearMonth={$(=Max(YearMonth))}>}CUSTOMS_VALUE)

tresB
Champion III
Champion III

Your Max (Year ) is 2013 and Maxstring(Month) is Dec, and there is no data for that period. please check.

narender123
Specialist
Specialist
Author

Thanks Borja.

Some of my report based on max(day) or max(Day)-7 .So is working for max(day)part too??

Actually i have done all of these things well in my previous project where these expression running well but here these expression are not working .Could you tell me why this happens??

narender123
Specialist
Specialist
Author

Thanks Tresko.

But when i write

Sum({<year={$(=max(year))},month={$(=maxstring(month))}>}customsvalue)

for this its will take 1st max(year)=2013 after that it should take Max(month) of Max(Year)2013 like jun according to max(month) in database.

In qlikview it will take the expression logically like this.

I have done this things in my previous project where it is running successfully.

but here not??

Narender