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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Gilad
Contributor II
Contributor II

Is it possible to sum field in sections

Can i sum in Qlik field by sections

Gilad_0-1639634809948.png

Now i use

RangeSum(Above(TOTAL Sum({<CHILD_ACTION_FLAG = {2}>} NEW_DIFF_HH_NUMBER2 ),1,RowNo(TOTAL)))

NEW_DIFF_HH_NUMBER2 is Time Deff

 

Is there an option to reset the RangeSum back to 00:00:00 every time the CHILD_ACTION_FLAG is not equal 2 ?

Labels (1)
2 Solutions

Accepted Solutions
JordyWegman
Partner - Master
Partner - Master

Hi Gilad,

I haven't found a front-end solution yet, but you can use this in the script:

Final:
Load
	*,
    IF( RowNo() = 1
    	, 0
        , IF( CHILD_ACTION_FLAG = 2 and Previous( CHILD_ACTION_FLAG ) <> 2
        	, 0
            , IF( CHILD_ACTION_FLAG = 2 and Previous( CHILD_ACTION_FLAG ) = 2
                , NEW_DIFF_HH_NUMBER2 + Peek( _cntField)
                , IF( CHILD_ACTION_FLAG <> 2
                	, 0
                	, 999
				)
            )
       	)
    )    
        as _cntField
Resident Table
Order by COLLECTION_ID, SECOND_CATEGORY, DATE_SORT asc, CHILD_ACTION_FLAG asc
;

You need a resident load if you want to order the data correctly. So name your table Table (or something else) and execute this script.

Jordy

Climber

Work smarter, not harder

View solution in original post

Gilad
Contributor II
Contributor II
Author

Hi Jordy

Thanks the solution works great,
I only made one change to get started from the first line,

I replaced the zero with  - NEW_DIFF_HH_NUMBER2

 

Final:
Load
	*,
    IF( RowNo() = 1
    	, 0
        , IF( CHILD_ACTION_FLAG = 2 and Previous( CHILD_ACTION_FLAG ) <> 2
        	, NEW_DIFF_HH_NUMBER2//I replaced the zero
            , IF( CHILD_ACTION_FLAG = 2 and Previous( CHILD_ACTION_FLAG ) = 2
                , NEW_DIFF_HH_NUMBER2 + Peek( _cntField)
                , IF( CHILD_ACTION_FLAG <> 2
                	, 0
                	, 999
				)
            )
       	)
    )    
        as _cntField
Resident Table
Order by COLLECTION_ID, SECOND_CATEGORY, DATE_SORT asc, CHILD_ACTION_FLAG asc
;

 

 

Thank you very much for your help.

View solution in original post

4 Replies
JordyWegman
Partner - Master
Partner - Master

Hey Gilad,

Van you share the application? This would make solving this easier.

Jordy 

Climber 

Work smarter, not harder
Gilad
Contributor II
Contributor II
Author

Hey Jordy

The application file is attached.

the application is still in the experimental stage, hope this is clear enough.

Thenks,

Gilad.

 

JordyWegman
Partner - Master
Partner - Master

Hi Gilad,

I haven't found a front-end solution yet, but you can use this in the script:

Final:
Load
	*,
    IF( RowNo() = 1
    	, 0
        , IF( CHILD_ACTION_FLAG = 2 and Previous( CHILD_ACTION_FLAG ) <> 2
        	, 0
            , IF( CHILD_ACTION_FLAG = 2 and Previous( CHILD_ACTION_FLAG ) = 2
                , NEW_DIFF_HH_NUMBER2 + Peek( _cntField)
                , IF( CHILD_ACTION_FLAG <> 2
                	, 0
                	, 999
				)
            )
       	)
    )    
        as _cntField
Resident Table
Order by COLLECTION_ID, SECOND_CATEGORY, DATE_SORT asc, CHILD_ACTION_FLAG asc
;

You need a resident load if you want to order the data correctly. So name your table Table (or something else) and execute this script.

Jordy

Climber

Work smarter, not harder
Gilad
Contributor II
Contributor II
Author

Hi Jordy

Thanks the solution works great,
I only made one change to get started from the first line,

I replaced the zero with  - NEW_DIFF_HH_NUMBER2

 

Final:
Load
	*,
    IF( RowNo() = 1
    	, 0
        , IF( CHILD_ACTION_FLAG = 2 and Previous( CHILD_ACTION_FLAG ) <> 2
        	, NEW_DIFF_HH_NUMBER2//I replaced the zero
            , IF( CHILD_ACTION_FLAG = 2 and Previous( CHILD_ACTION_FLAG ) = 2
                , NEW_DIFF_HH_NUMBER2 + Peek( _cntField)
                , IF( CHILD_ACTION_FLAG <> 2
                	, 0
                	, 999
				)
            )
       	)
    )    
        as _cntField
Resident Table
Order by COLLECTION_ID, SECOND_CATEGORY, DATE_SORT asc, CHILD_ACTION_FLAG asc
;

 

 

Thank you very much for your help.