Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
desert_dweller
Contributor
Contributor

Loop syntax

Hive mind!

I have a requirement to create a table with one row for every date with various details from a resident table.

I need help with syntax of:

for every day between Min Date and Max Date in resident Transaction table (including days for which there are no transactions)

Load

sum(transaction amount),

loop date,

dimension

resident transaction

where transaction date<=loop date

group by dimension

next date;

Thanks in advance for any help!!

Labels (1)
1 Solution

Accepted Solutions
afurtado
Partner Ambassador/MVP
Partner Ambassador/MVP

You could use iterno()   https://help.qlik.com/en-US/sense/May2023/Subsystems/Hub/Content/Sense_Hub/Scripting/CounterFunction...

See my example

 

Table_Tmp:
LOAD * inline [
transaction amount, date , loop date
100 , 01/01/2023 , 10/01/2023
140 , 01/02/2023 , 10/02/2023
];

Final_Table:
LOAD
      "transaction amount",
      date("date"+(IterNo()-1)) as "date"
Resident Table_Tmp While "date"+(IterNo()-1) <= "loop date";
//
Drop Table Table_Tmp;

 

afurtado_0-1691369367533.png

 

 

 

 

furtado@farolbi.com.br

View solution in original post

2 Replies
afurtado
Partner Ambassador/MVP
Partner Ambassador/MVP

You could use iterno()   https://help.qlik.com/en-US/sense/May2023/Subsystems/Hub/Content/Sense_Hub/Scripting/CounterFunction...

See my example

 

Table_Tmp:
LOAD * inline [
transaction amount, date , loop date
100 , 01/01/2023 , 10/01/2023
140 , 01/02/2023 , 10/02/2023
];

Final_Table:
LOAD
      "transaction amount",
      date("date"+(IterNo()-1)) as "date"
Resident Table_Tmp While "date"+(IterNo()-1) <= "loop date";
//
Drop Table Table_Tmp;

 

afurtado_0-1691369367533.png

 

 

 

 

furtado@farolbi.com.br
desert_dweller
Contributor
Contributor
Author

Thank you, this pointed me in the right direction!