Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

HirisH_V7
Honored Contributor

Re: Date format

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
Contributor

Re: Date format

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
Honored Contributor

Re: Date format

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
Contributor

Re: Date format

@HirisH_V7 ,

Really thanks for your effort and incredible work.

It works perfectly. 

Thanks a million

HirisH_V7
Honored Contributor

Re: Date format

No Problem!

Happy Qliking. 🙂

HirisH
“Aspire to Inspire before we Expire!”