Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewaf
Creator
Creator

Join in Qlik

Hi Guys,

easy question for you  .

Max(Year) in my script is not working. The goal is to have the current year if the DRKY=07.

Year is a field of my calendar.

How i can do this?

Thank you

item cost.png

5 Replies
ankur_abhishek
Contributor III
Contributor III

Could please share the sample to check it.

vishsaggi
Champion III
Champion III

Yes, Max() is an aggr function, you need Group By clause for this.

LOAD

DRKY,

IF(Match(trim(DRKY), '07'), Max(Year), Left(DRDL01,4)) AS YearUnitCost

Group By DRKY;

SQL Select *

FROM .....

WHERE DRRT = 'CM' AND DRSY = '40';

May be if you are looking for Current Year why dont your use like

Year(Today())

LOAD

DRKY,

IF(Match(trim(DRKY), '07'), Year(Today()), Left(DRDL01,4)) AS YearUnitCost;

SQL Select *

FROM .....

WHERE DRRT = 'CM' AND DRSY = '40';

RSvebeck
Specialist
Specialist

Add both fields in the group by:


LOAD

DRKY,

IF(Match(trim(DRKY), '07'), Max(Year), Left(DRDL01,4)) AS YearUnitCost

Group By DRKY,Left(DRDL01,4));

SQL Select *

FROM .....

WHERE DRRT = 'CM' AND DRSY = '40';



Svebeck Consulting AB
vishsaggi
Champion III
Champion III

Oh thanks, it got skipped. You are right.

rongali491
Contributor II
Contributor II

Use year(today()) in place of max(Year).