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

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 II
Partner - Contributor II

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 II
Partner - Contributor II

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
Creator
Author

Olá Joao,

Muchas gracias, esa es exactamenta la solución. 

Que tenga un lindo día.

Chris