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: 
Not applicable

Make Date

Hi,

Please help me with the following task:

File name is 032014.

I have Data as :

Name,

     [1] as [01],

     [2] as [02],

     [3] as [03],

     [4] as [04],

     [5] as [05],

     [6] as [06],

     [7] as [07],

     [8] as [08],

     [9] as [09],

     [10],

     [11],

     [12],

     [13],

     [14],

     [15],

     [16],

     [17],

     [18],

     [19],

     [20],

     [21],

     [22],

     [23],

     [24],

     [25],

     [26],

     [27],

     [28],

     [29],

     [30],

     [31]

Note: Day pick from top header

  Month&year pick from filename

And my Requirement is :

In a straight table :Max(Date),Name, Value(Corresponding value according to the Max (Date). 

For example:

DateNameValue
9-Mar-2014A400
9-Mar-2014B401
9-Mar-2014C402
9-Mar-2014D403
9-Mar-2014F404

Thanks

Ankit

Labels (1)
1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Hi,

Please find attached file for solution.

Script used in file

Tab1:

CrossTable(Day, Value, 2)

LOAD

  FileName() AS FileName,

Name,

    [1],

    [2],

    [3],

    [4],

    [5],

    [6],

    [7],

    [8],

    [9],

    [10],

    [11],

    [12],

    [13],

    [14],

    [15],

    [16],

    [17],

    [18],

    [19],

    [20],

    [21],

    [22],

    [23],

    [24],

    [25],

    [26],

    [27],

    [28],

    [29],

    [30],

    [31]

FROM

[032014.xlsx]

(ooxml, embedded labels, table is Sheet1);

Data:

LOAD

*,

Date(Date#(Mid(FileName, 3,4) & '-'  & Num(Left(FileName, 2)) & '-'  & Day, 'YYYY-M-D')) as Date

RESIDENT Tab1;

DROP TABLE Tab1;

Dimensions : Name, Date

Expression : =Sum({<Date={"$(=Date(Max(Date)))"}>}Value)

or =Aggr(If(Max(TOTAL<Name> Date) = Date, Sum(Value)), Name, Date)

Regards,

Jagan.

View solution in original post

17 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi Ankit,

Try this expression and use Date and Name as Dimensions

=Sum({Date={"$(=Date(Max(Date), 'D-MMM-YYYY'))"}}Value)

Regards,

Jagan.

Not applicable
Author

Hi Jagan,

It says error in expression and giving no result.

Thanks

Ankit

Not applicable
Author

=sum({<Date={"$(=Date(Max(Date),'D-MMM-YYYY'))"}>}Value)

I think a minor typo.

CELAMBARASAN
Partner - Champion
Partner - Champion

Did you formed the date field using the top header and file name?

Not applicable
Author

Hi Ram,

Same error.

Thanks

Ankit

Not applicable
Author

Hi,

Yes I have done this till now.

Tab1:

CrossTable(day, Values,2)

LOAD  left(Filename(), 6) as Filedate,

     Name,

     [1] as [01],

     [2] as [02],

     [3] as [03],

     [4] as [04],

     [5] as [05],

     [6] as [06],

     [7] as [07],

     [8] as [08],

     [9] as [09],

     [10],

     [11],

     [12],

     [13],

     [14],

     [15],

     [16],

     [17],

     [18],

     [19],

     [20],

     [21],

     [22],

     [23],

     [24],

     [25],

     [26],

     [27],

     [28],

     [29],

     [30],

     [31]

    

   

   

FROM

(ooxml, embedded labels, table is Data);

Load

Values,

Name,

Date(Max(Date(date#(day &''& Filedate,'DDMMYYY'),'DD/MM/YYYY'))) AS DATE

Resident Tab1

Group By Name,Values;

Drop Table Tab1;

Thanks

jagan
Partner - Champion III
Partner - Champion III

Hi,

Can you attach some sample file?  I think you need to use CrossTable to transform the data and then arrive a date field.

Regards,

Jagan.

jagan
Partner - Champion III
Partner - Champion III

Tab1:

CrossTable(day, Values,2)

LOAD  left(Filename(), 6) as Filedate,

     Name,

     [1] as [01],

     [2] as [02],

     [3] as [03],

     [4] as [04],

     [5] as [05],

     [6] as [06],

     [7] as [07],

     [8] as [08],

     [9] as [09],

     [10],

     [11],

     [12],

     [13],

     [14],

     [15],

     [16],

     [17],

     [18],

     [19],

     [20],

     [21],

     [22],

     [23],

     [24],

     [25],

     [26],

     [27],

     [28],

     [29],

     [30],

     [31]

FROM

(ooxml, embedded labels, table is Data);

Data:

LOAD

*,

MakeDate(Right(Filedate, 4), Left(Filedate, 2), day) Date

RESIDENT Tab1;

DROP TABLE Tab1;

Now in chart Try this expression and use Date and Name as Dimensions

=Sum({<Date={"$(=Date(Max(Date)))"}>}Value)

Regards,

Jagan.

preminqlik
Specialist II
Specialist II

yes after doing cross table do this , add  dimensions like below :

1. aggr(max(Date),Name)

2.Name

expression :

Sum (Value)