Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to display first and last value ?

I am new to qlikeview,  basically i want display first and last (based on user chosen date range )  record from the following rows.

Source

ClientProductDateOpening BalanceAddition WithdrawalClosing Balance
AX01/04/201610000020000102000
AX02/04/201610200001000101000
AX05/05/201610100000101000
AX12/08/201610100030000104000
AY01/04/20162000002000
AY05/05/2016200010002100
AY12/08/201621000502050
BX01/04/2016300020003200
BX12/08/201632000503150

filter : From 01/04/2016 to 12/08/2016

Output

ClientProductDateOpening BalanceAdditionWithdrawalClosing Balance
AX01/04/201610000050001000104000
AY01/04/20162000100502050
BX01/04/20163000200503150
1 Solution

Accepted Solutions
Digvijay_Singh

I think the one I posted has this feature

View solution in original post

11 Replies
Not applicable
Author

Hi,

Please check the attached file

Anonymous
Not applicable
Author

You want for First Value of Date only??

Have you checked FirstValue() & LastValue()  or FirstsortedValue() function in qlik?

First and Last value

varshavig12
Specialist
Specialist

addition:

aggr(sum({<Date=>}Addition),Client,Product)

Withdrawal:

aggr(sum({<Date=>}Withdrawal),Client,Product)

Frank_Hartmann
Master II
Master II

Have a look at attached qvw.

Dimensions:

-client

-Product

-Date

Expressions:

-Opening Balance: =aggr(min([Opening Balance]),Product,Client)

-Addition: aggr(sum({<Date=>}Addition),Client,Product)

-Withdrawal: aggr(sum({<Date=>}Withdrawal),Client,Product)

- closing Balance: =[Opening Balance]+aggr(sum({<Date=>}Addition),Client,Product)-aggr(sum({<Date=>}Withdrawal),Client,Product)

Hope that helps

susovan
Partner - Specialist
Partner - Specialist

Hi Rock,

PFA

Capture.JPG

Warm Regards,
Susovan
Digvijay_Singh

Try this -

Capture.JPG

qliksus
Specialist II
Specialist II

Please check if this ok for you

Opening Balance : sum({<Date={'$(=date(min({1}Date),'DD/MM/YYYY'))'}>}[Opening Balance])

Addition : sum({<Date={'$(=date(min({1}Date),'DD/MM/YYYY'))'}>} aggr(  sum( TOTAL<Client,Product>  Addition) ,Client,Product) )

Withdrawl : sum({<Date={'$(=date(min({1}Date),'DD/MM/YYYY'))'}>} aggr( sum(TOTAL<Client,Product> Withdrawal) ,Client,Product) )

Closing Balance: sum({<Date={'$(=date(min({1}Date),'DD/MM/YYYY'))'}>} TOTAL<Client,Product> aggr( sum({<Date={'$(=date(max({1}Date),'DD/MM/YYYY'))'}>}[Closing Balance]) ,Client,Product) )

Digvijay_Singh

Implemented Start Date and End Date selection logic -

Not applicable
Author

ya, thank you. now its always returning max and min date value, but it should return  based on the date range. Example:- if i choose from date: 01/04/2016 To date: 01/04/2016. i should get following output.

Source

ClientProductDateOpening BalanceAdditionWithdrawalClosing Balance
AY01/04/20162000002000
AY05/05/2016200010002100
AY12/08/201621000502050
AX01/04/201610000020000102000
AX02/04/201610200001000101000
AX05/05/201610100000101000
AX12/08/201610100030000104000
BX01/04/2016300020003200
BX12/08/201632000503150

Output

ClientProductDateOpening BalanceAdditionWithdrawalClosing Balance
AX01/04/20161000002000010200
AY01/04/20162000002000
BX01/04/2016300020003200