Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Group between dates from Resident Table

Hi everyone, hope someone can help me. I have a table with four fields, CodArt, FromDate, ToDate and Price. As you can see in the following picture I have several records of the same CodArt and same Price, but with different FromDate values. What I'm trying to achieve is reduce the first table to the second one.

Captura.JPG

Thank you in advance

Mensaje editado por: Pedro Burgo

1 Solution

Accepted Solutions
varshavig12
Specialist
Specialist

load date(min(FromDate)) as FromDate, date(max(ToDate)) as ToDate,CodArt,Price

group by CodArt,Price;

LOAD * INLINE [

  

    CodArt, FromDate, ToDate, Price

    E448, 02-01-16, 03-01-16, 1.82

    E448, 04-01-16, 04-01-16, 1.82

    E448, 05-01-16, 06-01-16, 1.82

    E448, 07-01-16, 10-01-16, 1.82

    E448, 11-01-16, 11-01-16, 1.45

    E448, 12-01-16, 14-01-16, 1.45

    E448, 15-01-16, 17-01-16, 1.45

    E448, 18-01-16, 18-01-16, 1.75

    A150, 02-01-16, 04-01-16, 2.00

    A150, 05-01-16, 05-01-16, 2.00

    A150, 06-01-16, 07-01-16, 2.00

    A150, 08-01-16, 10-01-16, 3.00

];

View solution in original post

8 Replies
vinieme12
Champion III
Champion III

can you post sample excel?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

There it is. Thanks for your time

Anonymous
Not applicable
Author

Hi ,

May be this will help you.

Add dimension CodArt and price

Exp-From date

aggr(min(FromDate),Price,CodArt)

To date

aggr(max(ToDate),Price,CodArt)

Thanks

Paridhi

Anonymous
Not applicable
Author

Hi Paridhi, I need to get the second table while loading the data in the script in order to use it later. I'm not trying to get a graphic table.

Sorry if I didn´t make myself clear enough.

Thanks

varshavig12
Specialist
Specialist

load date(min(FromDate)) as FromDate, date(max(ToDate)) as ToDate,CodArt,Price

group by CodArt,Price;

LOAD * INLINE [

  

    CodArt, FromDate, ToDate, Price

    E448, 02-01-16, 03-01-16, 1.82

    E448, 04-01-16, 04-01-16, 1.82

    E448, 05-01-16, 06-01-16, 1.82

    E448, 07-01-16, 10-01-16, 1.82

    E448, 11-01-16, 11-01-16, 1.45

    E448, 12-01-16, 14-01-16, 1.45

    E448, 15-01-16, 17-01-16, 1.45

    E448, 18-01-16, 18-01-16, 1.75

    A150, 02-01-16, 04-01-16, 2.00

    A150, 05-01-16, 05-01-16, 2.00

    A150, 06-01-16, 07-01-16, 2.00

    A150, 08-01-16, 10-01-16, 3.00

];

varshavig12
Specialist
Specialist

Anonymous
Not applicable
Author

Yeah It works, Thank you Varsha

Anonymous
Not applicable
Author

Hi,

PFB

LOAD CodArt,

     max(Date(FromDate)) as FromDate,

     min(Date(ToDate) ) as ToDate,

     Price

    

FROM

(ooxml, embedded labels, table is Hoja1)

Group By CodArt , Price;