Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
suresh_qv50
Creator
Creator

Aggr Function with Varible Error

Hello,

In Qliksense

Aggregrate Function with DrillDown group Getting Error

Dim (Drilldown group)  --> Quarter,Month,Date   Created

Created 1 Variable -->

vDim = IF(GETSELECTEDCOUNT([Quarter])=1 AND GETSELECTEDCOUNT([Month])=1,'[Date]',

IF(GETSELECTEDCOUNT([Quarter])=1,'[Month]','[Quarter]'))

Until This Works Fine.

When i use Aggr Function Looks Like

Num(Aggr(sum({<[PL.paidindays] = {'-14'}>}[PL.DueAmt]),Quarter),'$#,##0')

Num(Aggr(sum({<[PL.paidindays] = {'-14'}>}[PL.DueAmt]),Month),'$#,##0')

Num(Aggr(sum({<[PL.paidindays] = {'-14'}>}[PL.DueAmt]),Date),'$#,##0') --> All these 3 Expression Works fine


When i use Variable instead of Field it Getting ' - ' (error)

Num(Aggr(sum({<[PL.paidindays] = {'-14'}>}[PL.DueAmt]),$(vDim)),'$#,##0')  --> Getting Error.


I tested the Variable by using Textobject with Expresion as  $(vDim) its Working Fine, Reflecting the Same Filed Names.

Please Suggest any Solution ASAP



1 Solution

Accepted Solutions
marcus_sommer

Try as variable (without equal-sign at the beginning) and without single-quotes around the fieldnames):

vDim:

IF(GETSELECTEDCOUNT([Quarter])=1 AND GETSELECTEDCOUNT([Month])=1,[Date],

IF(GETSELECTEDCOUNT([Quarter])=1,[Month],[Quarter]))


and as expression:


Num(Aggr(sum({<[PL.paidindays] = {'-14'}>}[PL.DueAmt]),$(=vDim)),'$#,##0')


- Marcus

View solution in original post

5 Replies
sunny_talwar

Not sure why you even need a Aggr() here? Why not just this

Num(Sum({<[PL.paidindays] = {'-14'}>}[PL.DueAmt]), '$#,##0')

But in case it is needed and I am missing something, try this:

Num(Aggr(sum({<[PL.paidindays] = {'-14'}>}[PL.DueAmt]), $(=GetCurrentField([Dim])),'$#,##0')

suresh_qv50
Creator
Creator
Author

Hi Sunny,

Am talking About Qliksense, am remembering to you that in Qliksense there is no GetcurrentField() function available.

if i use Num(Sum({<[PL.paidindays] = {'-14'}>}[PL.DueAmt]), '$#,##0')

in Pivot getting invalid Dimension

so am using in that way.

sunny_talwar

Sure, GetCurrentField isn't available. Thanks for reminding that

Once again what is the issue when you don't use Aggr? Invalid dimension? This is used a  dimension or expression?

hirenjadiya
Partner - Contributor III
Partner - Contributor III

Hi Suresh,

I believe you need to evaluate the variable.

Try this

vDim = $(IF(GETSELECTEDCOUNT([Quarter])=1 AND GETSELECTEDCOUNT([Month])=1,'[Date]',

IF(GETSELECTEDCOUNT([Quarter])=1,'[Month]','[Quarter]')))



marcus_sommer

Try as variable (without equal-sign at the beginning) and without single-quotes around the fieldnames):

vDim:

IF(GETSELECTEDCOUNT([Quarter])=1 AND GETSELECTEDCOUNT([Month])=1,[Date],

IF(GETSELECTEDCOUNT([Quarter])=1,[Month],[Quarter]))


and as expression:


Num(Aggr(sum({<[PL.paidindays] = {'-14'}>}[PL.DueAmt]),$(=vDim)),'$#,##0')


- Marcus