Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
singhcv123
Contributor
Contributor

Current vs Prior Period vs same period last year

Hi,

I want to generate multiple Kpis for the current period, prior period, same period last year.

Is there any mechanism other than set analysis like , can i generate the data in qvd level and than store into table.

kindly suggest.

3 Replies
sunny_talwar

Not sure why would you want to do that? You can try this approach, but this is mostly used for charts, not so much for the text box objects: The As-Of Table

effinty2112
Master
Master

Hi Virendra,

                    I think the easiest way to do this is to set flags in your calendar script (I'm assuming your application has one).

Lines like this in the script should do the job:

Let vToday = Floor(Today());

if(DayNumberOfYear(Temp_Date)<=DayNumberOfYear($(vToday)),1,0)   as YTD,

if(DayNumberOfQuarter(Temp_Date)<=DayNumberOfQuarter($(vToday)),1,0)  as QTD,

if(Day(Temp_Date)<=Day($(vToday)),1,0)   as MTD

(EDIT : I was a bit unclear here. This script comes from a calendar script which is a preceding load where the Temp_Date is a field generated by a loop giving the dates between a start and end date - as per the common practice)

These flag fields can be selected in your dashboard or used in simple set analysis such as

SalesYTD = Sum({$<YTD = {1}>}Sales)

If you really want to avoid set analysis then:

SalesYTD = Sum(if(YTD = 1, Sales))

or

SalesYTD = Sum(YTD* Sales)


Good luck


Andrew

Anonymous
Not applicable

Please, check the correct answer.

thank you