Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Week index number

Good day!

Colleagues, tell me please, has QV some function to get index number of values in some field (not in load script)

Model and necessary WeekNumber in attached file.

Thanks.

32 Replies
Anonymous
Not applicable
Author

In that table. By weeks.

t_chetirbok
Creator III
Creator III

Hello!

you can use recno() and expression like sum({<Rec = {">=$(=max(total Rec)-14) "}>}Sales).

See example

HirisH_V7
Master
Master

Hi ,

can you provide your required Output,

Inter-Record Functions

Check this,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
Anonymous
Not applicable
Author

Thanks for your solution.

But i need calculate sum without changing script (model has more 3 hours for reload)

Anonymous
Not applicable
Author

My required output in attached model

t_chetirbok
Creator III
Creator III

ok,

try this expression

if(sum(total if(left(YearWeek,4)=left(max(total YearWeek),4),1,0))<14,

  sum( {<YearWeek = {">$(=max(total if(left(YearWeek,4)<>left(max(total YearWeek),4),YearWeek ))-14+sum(total if(left(YearWeek,4)=left(max(total YearWeek),4),1,0))) "}>}

  Sales)

  , sum( {<YearWeek = {">$(=max(total YearWeek) -14)"}>}Sales)

)

It's difficult, but the only thing that I thought of

HirisH_V7
Master
Master

Hi ,

Hope this is what you required,

Two Dimensions:

=Aggr(Mid(YearWeek,1,4),YearWeek)  as Year

=Aggr(Mid(YearWeek,5,6),YearWeek)  as week

Expression:

=If(YearWeek>='201540',Sum(Sales))

Output:

Weekly Basis Calculated Dimension.PNG



Hope this helps,

PFA,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
t_chetirbok
Creator III
Creator III

In your example, if add YearWeek 201602, we should to change expression If(YearWeek>='201541',Sum(Sales))

So, we always should to change expression manually, the chart is not automatic

HirisH_V7
Master
Master

Hi,

Yes,It will be after '201601' right.I think new entries are required.

or Else

we can write conditional expression like this,

=If(YearWeek>='201540' and YearWeek<='201601',Sum(Sales))

Hope this helps,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
Anonymous
Not applicable
Author

Dear colleagues, thanks for your help!

My charts must be calculated on automatic base.

Maybe your give me advice how to get YearWeek index number in load script?