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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggregate minimal date with minimal price problem!

Hello guys,

i have a little problem. I want to get the date when a person buyed a specific item with the MINIMAL price. The data looks like this:

ItemPriceDate
x1212.01.2014
x2317.02.2014
x4516.03.2014
y12310.10.2005
y12320.12.2013
y12305.03.2012

So i want to get that product x was bought with the minimal price on 12.01.2014 and product y on 10.10.2005.

I've tried with the Firstsortedvalue() it works okay but when i put that date into set analysis -> Sum({<Date=(>=("FirstSortedValue(...)>} quantity) i get nothing...

So is there any solution to get that date during a script load ?

Thanks in advance!

Jacek

6 Replies
tresesco
MVP
MVP

Try like:

=FirstSortedValue(Aggr(Sum(Price),Date), Date)

Not applicable
Author

I want to just get the min date when the product was bought with the min price

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

Data:

LOAD

*,

If(Previous(Item) <> Item, 1, 0) AS LowestPriceFlag;

LOAD

*

FROM DataSource

ORDER BY Item, Price, Date;

Now LowestPriceFlag column has lowest date.

In set analysis try like this

Dimension: Item

Expression : Only({<LowestPriceFlag={1}>} Date)

Hope this helps you.

Regards,

jagan.

tresesco
MVP
MVP

It should be easier:

=FirstSortedValue(distinct Date, Price)


PFA

martinpohl
Partner - Master
Partner - Master

Hi,

set analysis won't work with this problem.

Use a formula like this

sum( if( aggr(nodistinct min(Date), Item) = Date, Price, 0))

within an chart with Item as dimension.

Regards

MK_QSL
MVP
MVP

=Date(FirstSortedValue(Distinct Date, Price))