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

Variables and KPI object

I am currently pulling data from QlikView into Qlik Sense and I have the following in QlikView script:

[Wk Start],

Date(Date#([Wk Start], 'YYYYMMDD')) as WkStartDate,

Date(MonthStart(Date#([Wk Start], 'YYYYMMDD')), 'MM-YYYY')  as WkStartMonthYear,

Month(Date#([Wk Start], 'YYYYMMDD'))  as WkStartMonth,

Year(Date#([Wk Start], 'YYYYMMDD'))  as FYBIKPIYear,

if(Month(Date#([Wk Start], 'YYYYMMDD')) > 6, Year(Date#([Wk Start], 'YYYYMMDD'))+1, Year(Date#([Wk Start], 'YYYYMMDD'))) as WkStartFiscalYear,

dual(month(Date#([Wk Start], 'YYYYMMDD')),month(addmonths(Date#([Wk Start], 'YYYYMMDD'),6))) as WkStartFiscalMonth;

I created variables in Qlik Sense (similar to the ones in Qlik View) :

vMaxWkStartDate=Max(WkStartDate)

vCurrentweek =sum({<WkStartDate= {"$(=Date(Max(WkStartDate, 'YYYYMMDD')))"}>}[SOH Value])

vPriorweek=sum({<WkStartDate= {"$(=Date(Max(WkStartDate, 'YYYYMMDD')-7))"}>}[SOH Value])

I tried the expression below in a KPI object but it does not work:

=Sum ({<[Wk Start]={"<=$(vMaxWkStartDate)"}>} [SOH Value])

I tried to use the next two variables in an expression to calculate the change in the week but that also did not work:

=Sum ({<[Wk Start]={"<=$(vCurrentweek)"}>} [SOH Value])-Sum({<[Wk Start]={'<=$(vPriorWkStartDate)'}>} [SOH Value]))

The format of the WkStartDate in the file is YYYYMMDD

Appreciate your assistance.

2 Replies
ahaahaaha
Partner - Master
Partner - Master

Hi Shamit,

Can we see a fragment of the original data and the expected result?

Regards,

Andrey


shamitshah
Partner - Creator
Partner - Creator
Author

Hi Andrey,

Thanks, I have now been able to sort my issue.

Regards

Shamit