Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
karelibarcar
Contributor III
Contributor III

How to use a field into a for loop like an expression?

Hi dear community,

Can you help me? I want to use a for loop, something like this:

 

For vYear = year(Start_Date) to Year(End_Date)

Load

Makedate($(vYear), Month(Date), Day(Date) as Date,

Start_Date,

End_Date

Resident myTable;

Next vYear;

 

This make me an error: the error was occured in For vYear = year(Start_Date) to Year(End_Date) 

and I don't know how to resolve this.

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Try this

LOAD Date(Start_Date + IterNo() - 1) as Date,
     Start_Date,
     End_Date
Resident myTable
While Start_Date + IterNo() - 1 <= End_Date;

View solution in original post

2 Replies
sunny_talwar

Try this

LOAD Date(Start_Date + IterNo() - 1) as Date,
     Start_Date,
     End_Date
Resident myTable
While Start_Date + IterNo() - 1 <= End_Date;
karelibarcar
Contributor III
Contributor III
Author

Perfect!

Thank you very much! That works fine!!

😊