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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Showing week number in Field name

Hi

I am trying to get my field name to display Wk01 in the example below as the current week. This is a forecast model so the weeks should update automatically when the file is accessed.

Instead of having Week01Qty, I want to see Week 33 Qty - if current week is week 33.

I hope someone can assist with this.

Thanks

Soreen

if

(ContractBalance.WeeksRemaining>=1,ContractBalance.WeeklyQty,0) AS Week01Qty, //to display as Week(Current) & 'Qty'//

if



(ContractBalance.WeeksRemaining>=2,ContractBalance.WeeklyQty,0) AS Week02Qty, //to display as Week(Current)+1 & 'Qty'//

if(ContractBalance.WeeksRemaining>=3,ContractBalance.WeeklyQty,0) AS Week03Qty, //to display as Week(Current)+2 & 'Qty'//









if







3 Replies
Not applicable
Author

Sorry Soren I don't understand what you are looking for. Can you explain more?

Andrea

Anonymous
Not applicable
Author

It is possible to handle through using variables in a loop

Table:
LOAD * INLINE [
<just a name of at least one field in the table, no any data>
];

FOR W = 1 to 53
CONCATNATE (Table)
LOAD
...
<expression> as Week$(W)Qty,
...
RESIDENT...
WHERE week(<some date field>) = $(W);
NEXT

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Are you sure that creating new field(s) for each week number is what you want to do? That could result in a very cumbersome data model and you would probably have to modify the expressions each week to keep in synch with the fields.

I appreciate that you might have a compelling reason for this design, but the normal approach would be to have Qty field and a date field (which could be a week number field) in the transaction table.

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein