Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ribeiro
Specialist
Specialist

Previous balance and Current balance by date and time by Cod load

I need to make Balance in the Ant and Final
By Code, Date Time,
Any suggestion
Data Hora Cod Tipo Ant. E S Final
        418 119  
21/12/2000 00:00:00 9147 E 0 12 0 12
21/12/2000 00:00:00 9148 E 0 47 0 47
05/01/2008 00:00:00 9147 S 0 0 1 -1
05/01/2008 00:00:00 9148 S 0 0 1 -1
08/01/2008 09:22:06 9148 S 0 0 99 -99
08/01/2008 09:22:06 9147 S 0 0 18 -18
13/01/2010 13:51:30 9147 E 0 124 0 124
13/01/2010 13:51:30 9148 E 0 235 0 235
             
Example code 9147,
I would like everyone's balance, follow the example spreadsheet.
Data Hora Cod Tipo Ant. E S Final
        418 119  
21/12/2000 00:00:00 9147 E 0 12 0 12
05/01/2008 00:00:00 9147 S 12 0 1 11
08/01/2008 09:22:06 9147 S 11 0 18 -7
13/01/2010 13:51:30 9147 E -7 124 0 117
Neves
Labels (4)
1 Reply
Chanty4u
MVP
MVP

You can try this 

Table1:

LOAD

    [Data Hora],

    Cod,

    Tipo,

    Ant,

    E,

    S,

    Final

FROM [your_data_source.csv]

(ooxml, embedded labels, table i

s Sheet1);

 

Table2:

LOAD

    [Data Hora],

    Cod,

    Tipo,

    Ant,

    E,

    S,

    Final,

    if(Tipo = 'E', Peek('Final') + E - S, Peek('Final')) as Balance

Resident Table1

Order by Cod, [

Data Hora];