Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
pgalvezt
Specialist
Specialist

Operation with periods

Hello!!

I would like to obtain this operation by periods, is it posible in qliksense?

I attach the chart excel example,

Thanks!!

3 Replies
Anil_Babu_Samineni

Yes, Perhaps this way,

Here Periodo_Yr is the field from script like Year(Periodo) as Periodo_Yr

And then expression could be this

Num(Sum({<Periodo_Yr={"$(=Max(Periodo_Yr-1))"}>}Monto)/Above(Sum({<Periodo_Yr={"$(=Max(Periodo_Yr))"}>}Monto),-12,1), '#.##0%')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
edwin
Master II
Master II

another way is to associate current with next years period via script:

SET DateFormat='M/D/YYYY';
SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';
SET FirstWeekDay=6;
SET BrokenWeeks=1;
SET ReferenceDay=0;
SET FirstMonthOfYear=1;
SET CollationLocale='en-US';
SET CreateSearchIndexOnReload=1;
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
SET LongDayNames='Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday';
SET NumericalAbbreviation='3:k;6:M;9:G;12:T;15:P;18:E;21:Z;24:Y;-3:m;-6:μ;-9:n;-12:p;-15:f;-18:a;-21:z;-24:y';

data:
load AddMonths(date('1/1/2019'), iterno()-1) as Date, floor(rand()*1000)/100 as Amount
while iterno()<=24;
load 1 AutoGenerate(1);

NoConcatenate
Bridge:
load distinct Date, Date as Period, 'CURRENT' as PeriodType Resident data;Add

Concatenate(Bridge)
load distinct AddYears(Date,1) as Date, Date as Period, 'NEXT' as PeriodType Resident data;

 

in your chart, your dimension is Period, expression is 

Sum({<PeriodType={'CURRENT'}>}Amount)/Sum({<PeriodType={'NEXT'}>}Amount)

 

edwin
Master II
Master II

here is a sample output:

edwin_0-1608928865349.png