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

Firstsorted Value by Date and Time

Hi All,

I am trying to use an expression in a straight table to show the first transaction for each day.

I have the following Table

2017-08-24_1104.png

And I want the following result

2017-08-24_1105.png

So I need the first R transactions for each Day based on the time.

I hope you can help.

                                                                                                                                                              

DateProductStartTimeTransaction TypeAmount
08/03/2017BB4BL264R07:02:38R1
08/03/2017MAAX94S07:03:17R1
08/03/2017RB78335107:03:27D1
09/03/2017BB4BL238R06:41:41D1
09/03/2017RB78604806:59:57R1
09/03/2017RB78605507:00:14R1
10/03/2017JV6009607:02:56R1
10/03/2017JV6009607:02:59R1
10/03/2017MP00267607:03:17R1
DateProductStartTimeTransaction TypeAmount
08/03/2017BB4BL264R07:02:38R1
09/03/2017RB78604806:59:57R1
10/03/2017JV6009607:02:56R1
19 Replies
Kushal_Chawda

Have you tried my solution?

rustyfishbones
Master II
Master II
Author

No, I want to do it as an expression for now, I don't really want to change the script right now.

I have some success with the following expression

AGGR(FirstSortedValue([Transaction Type], Time#(StartTime, 'hh:mm:ss')),Date)

So I would like to SUM the Amount where the transaction type = R

Kushal_Chawda

try this


FirstSortedValue(DISTINCT {<[Transaction Type]={'R'}>} Amount , aggr(Time#(only({<[Transaction Type]={'R'}>} StartTime), 'hh:mm:ss'),Date))       

rustyfishbones
Master II
Master II
Author

I have tried that and it returns nothing, I will keep trying, I know it will be a simple solution in the end.

tresesco
MVP
MVP

Hi,

Did you check my last reply?

rustyfishbones
Master II
Master II
Author

Yes, I ca see it's working in your file, nut not in mine??

rustyfishbones
Master II
Master II
Author

Hi,

It's working now with the following

AGGR(FirstSortedValue({<[Transaction Type] = {'R'}>} [Transaction Type], Time#(StartTime, 'hh:mm:ss')),Date)

sunny_talwar

Another option

Dimension

Date

Transaction Type

Expressions

Only({<[Transaction Type] = {'R'}>}Aggr(If(StartTime = Min(TOTAL <Date> {<[Transaction Type] = {'R'}>} StartTime), Only({<[Transaction Type] = {'R'}>}Product)), Product, Date, StartTime))

Time(Min({<[Transaction Type] = {'R'}>}Time#(StartTime,'hh:mm:ss')))

Sum({<[Transaction Type] = {'R'}>}Aggr(If(StartTime = Min(TOTAL <Date> {<[Transaction Type] = {'R'}>} StartTime), Sum({<[Transaction Type] = {'R'}>}Amount)), Product, Date, StartTime))

Used tresesco‌'s sample file to create a new chart (thanks)

Capture.PNG

Best,

Sunny

rustyfishbones
Master II
Master II
Author

I jumped the gun, still not correct.

rustyfishbones
Master II
Master II
Author

Thanks Sunny, that worked perfectly!