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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
wunderch
Creator II
Creator II

set analysis with min(date) by dimension

Hi guys,

I have the following table:

product date price
A 01.01.2018 100
A 01.01.2019 120
A 01.01.2020 150
A 01.01.2021 190
A 01.01.2022 250
A 01.01.2023 300
B 01.01.2020 400
B 01.01.2021 470
B 01.01.2022 500
B 01.01.2023 600

 

So my challenge is, when I select date from 01.01.2019 to 01.01.2022 I want get the following table

product Startprice Endprice
A 120 250
B 400 500

 

If a price on Startdate is available then take this price, if no price is available then take the first price what is in the selected date range.

I think the formula must be something like this:

aggr(only({<date={aggr(min(date), product)}>} price),  product)

Thanks for your help!

Regards 

Chris

 

 

Labels (1)
1 Solution

Accepted Solutions
joao_renato
Partner - Contributor III
Partner - Contributor III

Olá,
Testa as seguintes expressões:

Startprice: Sum(If(Aggr(nodistinct Min(date),product) = date, price))
Endprice: Sum(If(Aggr(nodistinct Max(date),product) = date, price))

joao_renato_0-1678284353420.png

 

View solution in original post

2 Replies
joao_renato
Partner - Contributor III
Partner - Contributor III

Olá,
Testa as seguintes expressões:

Startprice: Sum(If(Aggr(nodistinct Min(date),product) = date, price))
Endprice: Sum(If(Aggr(nodistinct Max(date),product) = date, price))

joao_renato_0-1678284353420.png

 

wunderch
Creator II
Creator II
Author

Olá Joao,

Muchas gracias, esa es exactamenta la solución. 

Que tenga un lindo día.

Chris