Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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
Honored Contributor III

Re: Sum of Current Year

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]))

Re: Sum of Current Year

May be this:

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

balrajahlawat
Esteemed Contributor

Re: Sum of Current Year

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]))

balrajahlawat
Esteemed Contributor

Re: Sum of Current Year

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

Re: Sum of Current Year

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?

reddys310
Honored Contributor II

Re: Sum of Current Year

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
Valued Contributor II

Re: Sum of Current Year

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]))

Community Browser