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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum of Current Year

Good Morning,

Could someone help, I think I have something wrong.

I have created the following:

Sum({$<Year={$(=Max(Year))}>} SUM([Crew])

-

Sum({<[Accident Category]={'Total Recordable Cases (TRC)'}>}[Crew])

-

Sum({<[Accident Category]={'Lost Time Injuries (LTI)'}>}[Crew]))

I want to get the total of Crew for the current year minus the totals of TRC and LTI.

But it is not working, anyone see why?

Thanks

7 Replies
arulsettu
Master III
Master III

may be like this

Sum({$<Year={$(=Max(Year))}>} [Crew])

-

Sum({<[Accident Category]={'Total Recordable Cases (TRC)'}>}[Crew])

-

Sum({<[Accident Category]={'Lost Time Injuries (LTI)'}>}[Crew]))

sunny_talwar

May be this:

RangeSum(Sum({$<Year={$(=Max(Year))}>} Crew), -Sum({<[Accident Category] = {'Total Recordable Cases (TRC)', 'Lost Time Injuries (LTI)'}>} Crew))

Anonymous
Not applicable
Author

may be like this?

=((Sum({$<Year={'=$(=Max(Year))'}>} [Crew])

-

Sum({<[Accident Category]={'Total Recordable Cases (TRC)'}>} [Crew]))

-

Sum({<[Accident Category]={'Lost Time Injuries (LTI)'}>} [Crew]))

Anonymous
Not applicable
Author

Even you can do like this:

=(Sum({$<Year={'=$(=Max(Year))'}>} [Crew])

-

Sum({<[Accident Category]={'Total Recordable Cases (TRC)','Lost Time Injuries (LTI)'}>} [Crew]))

Not applicable
Author

Thanks, but none of those are giving the correct answer.

I am not sure if the first year selection is then applying to the following sums?

reddy-s
Master II
Master II

Hi Daniel,

It would be very easy doing it with a master calander.

Just making use of the inyeartodate() dunction will solve your issue, other wise Sunny's solution should work.

Thanks and Regards,

Sangram Reddy.

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

I think you need bracket for the last 2 expression. Meaning the last 2 expression calculation takes place first and then the first expression

Sum({$<Year={$(=Max(Year))}>} [Crew])

-

(Sum({<[Accident Category]={'Total Recordable Cases (TRC)'}>}[Crew])

-

Sum({<[Accident Category]={'Lost Time Injuries (LTI)'}>}[Crew]))