Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
tan_chungkam
Creator
Creator

Date format

Hi All,

Could Qliksense regonized the number 20181201 as  Year 2018 Month 12 and Week 1?

Is there any ways to do that?image.png

Labels (2)
14 Replies
HirisH_V7
Master
Master

Use these then,

Current Period:

Sum({<Month={"$(=MonthName(Max(Month)))"},Week={"$(=Max(Week))"}>} Sales)

Previous Period:

If(Max({<Year={'$(=Max(Year))'},Month={"$(=MonthName(Max(Month)))"}>}Week)=2,
Sum({<Month={"$(=MonthName(Max(Month)))"},Week={"$(=Max(Week)-1)"}>} Sales),
Sum({<Month={"$(=MonthName(AddMonths(Max(Month),-1)))"},Week={"$(=Max(Week))"}>} Sales))

HTH,

Hirish

 

HirisH
“Aspire to Inspire before we Expire!”
tan_chungkam
Creator
Creator
Author

Hi @HirisH_V7 ,

Thanks again.

For the current Period work well.

For the previous Period doesn't work correctly.

If i select 20190101 it is showing 20181201 sales figure.

It is supposed to show 20181202 sales figure.

image.png

HirisH_V7
Master
Master

Hello I have revamped some code it will  be straight. 

Hope it serves u r purpose well.

 

Date:
LOAD * INLINE [
    Format, Sales
    20181201, 2222
    20181202, 22522
    20190101, 3333
    20190102, 33353
    20190102, 545544
];

Sort:
Load distinct Format,AutoNumber(Format) as Sort
Resident Date Order by Format;

 

 

Current:

Sum({<Sort={"$(=(Max(Sort)))"}>} Sales)

Previous:

Sum({1<Sort={"$(=(Max(Sort)-1))"}>} Sales)

 

 

PFA For ref.

HirisH
“Aspire to Inspire before we Expire!”
tan_chungkam
Creator
Creator
Author

@HirisH_V7 ,

Really thanks for your effort and incredible work.

It works perfectly. 

Thanks a million

HirisH_V7
Master
Master

No Problem!

Happy Qliking. 🙂

HirisH
“Aspire to Inspire before we Expire!”