Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
gkouris77
Contributor II
Contributor II

Select a Cost at a point of time

Hi, i am new to Qlik Sense and I am trying to select a cost in point of time, and i cant seem to get the correct expression.

So i have a list Average Cost, and what i need is based on the Selected date i want to return the max date average cost that is equal to or less to the selected date. I have tried the below, expression but i cannot get it to work.

=if($(vSelectDate)=<[TransDate],max([TransDate],[TransDate]=<$(vSelectDate)),[TransDate])

Any help would be appreciated.

Capture.PNG

Thanks

George

10 Replies
Anil_Babu_Samineni

This is my last attempt from me?

Script looks like?

LOAD Date(TransDate,'DD-MM-YYYY') as TransDate,

Peek(TransDate) as Previous,

     AverageCost

FROM

(ooxml, embedded labels, table is Sheet1);

And Measure either of the below?

FirstSortedValue(AverageCost, -Aggr(Sum({<TransDate = P(Previous)>} AverageCost), Previous))


Or

Sum({<TransDate = P(Previous)>} AverageCost)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful