Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
nihhalmca
Specialist II
Specialist II

Set Analysis for Max Date

Hi All,

I need to show report account wise, sales for max (date) for instance

Account     Date             Sales

1               01-sep-13        100

1               02-sep-13        120

1               03-sep-13        130

2               05-Sep-13        150

2               06-Sep-13        160

3               08-Sep-13        140

3               09-Sep-13         110

3               10-Sep-13         100

4                11-Sep-13         200

4                12-Sep-13          290

4                13-Sep-13          280

Thanks in Advance

Nihhal

1 Solution

Accepted Solutions
Anonymous
Not applicable

Example attached.

View solution in original post

9 Replies
Gysbert_Wassenaar

Use Account and Date as dimensions and as expression FirstSortedValue(Sales, -Date). Make sure Date is a numeric date field and not string values. Use the date# function if it's necessary to convert a string to a numeric date.


talk is cheap, supply exceeds demand
Anonymous
Not applicable

Hey,

1. make sure that Date field stores a proper date (not a text), you can convert this text to date in a load script, example:

load

Account,

date(Date#(upper(Date),'DD-MMM-YY')) as Date,

Sales

inline [

Account,Date,Sales

1,01-sep-13,100

1,02-sep-13,120

1,03-sep-13,130

2,05-Sep-13,150

2,06-Sep-13,160

3,08-Sep-13,140

3,09-Sep-13,110

3,10-Sep-13,100

4,11-Sep-13,200

4,12-Sep-13,290

4,13-Sep-13,280

];


2. Create a Straight Table, add Account as Dimension and as expression add the following:

sum(aggr(if(Date=date(max(total <Account> Date)),sum(Sales)),Account,Date))

Best

K

nihhalmca
Specialist II
Specialist II
Author

Thank you for response,

Not working your logic

nihhalmca
Specialist II
Specialist II
Author

Thank you for response,

not working your logic

Anonymous
Not applicable

Does work. You may need to adjust the example I gave you to your scenario/data model.

temp.JPG.jpg

Anonymous
Not applicable

Example attached.

nihhalmca
Specialist II
Specialist II
Author

Thank you Karol Now working fine, i hope previously i might have done mistake

nihhalmca
Specialist II
Specialist II
Author

Thank You Karol

NiHhal.

Anonymous
Not applicable

Hi Gysbert,

I have checked your expression and found that only Account dimension needed to add i think its not Date and Account both with FirstSortedValue() function or i am wrong?

anant