Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
dselgo_eidex
Partner - Creator III
Partner - Creator III

Error in calculated dimension

Hello, I'm having a problem with the following calculated dimension:

=if([Fiscal Year] <= max({$<

       [District Name] = {'$(vMyDistrictName)'}

       >}[Fiscal Year]

  ), [Fiscal Year]

)

I'm trying to get the maximum value for fiscal year and then only have the Axis go up to that value. Nothing is wrong with the Max() function because I have it displaying the correct year in a text box. QlikView just says that there is an error in expression and doesn't show any dimension values on the x-axis.

1 Solution

Accepted Solutions
marcus_sommer

If you used an aggregation-function within a calculated dimension you need to wrap the expression with an aggr-function, it should more look like:

=aggr(

if([Fiscal Year] <= max({$<

       [District Name] = {'$(vMyDistrictName)'}

       >}[Fiscal Year]

  ), [Fiscal Year]

),

[Fiscal Year])

Have also a look here:Calculated Dimensions

- Marcus

View solution in original post

6 Replies
Not applicable

Could you post your sample application?

sunny_talwar

May be this:

=If([Fiscal Year] <= Max(TOTAL {$<[District Name] = {'$(vMyDistrictName)'}>}[Fiscal Year]), [Fiscal Year])

marcus_sommer

If you used an aggregation-function within a calculated dimension you need to wrap the expression with an aggr-function, it should more look like:

=aggr(

if([Fiscal Year] <= max({$<

       [District Name] = {'$(vMyDistrictName)'}

       >}[Fiscal Year]

  ), [Fiscal Year]

),

[Fiscal Year])

Have also a look here:Calculated Dimensions

- Marcus

dselgo_eidex
Partner - Creator III
Partner - Creator III
Author

I think that this was correct. I ended up solving the problem I was having without using a calculated dimension so I'm not sure if this works, but from what you are saying I think it would. Thanks for all the help everyone.

arixooo123
Creator III
Creator III

Hi Marcus,

Hope you're well.
I have the same problem, I am trying to create a calculated dimension with below expression but I get the error.

I don't know how exactly I can wrap this inside aggr() function:

if(FirstSortedValue(DueIn,-%DateKey)<0

,'Overdue'

,if(FirstSortedValue(DueIn,-%DateKey)>=0

AND FirstSortedValue(DueIn,-%DateKey)<=5

AND WCategory='1'

  ,'Due Soon'

,if(FirstSortedValue(DueIn,-%DateKey)>=0

  AND FirstSortedValue(DueIn,-%DateKey)<=14

  AND WCategory='2'

  ,'Due Soon'

  ,if(FirstSortedValue(DueIn,-%DateKey)>=0

  AND FirstSortedValue(DueIn,-%DateKey)<=30

  AND WCategory='3'

  ,'Due Soon','Seen in Time'))))

marcus_sommer

The aggr comes on the outside in this way:

aggr(

if(FirstSortedValue(DueIn,-%DateKey)<0

,'Overdue'

,if(FirstSortedValue(DueIn,-%DateKey)>=0

AND FirstSortedValue(DueIn,-%DateKey)<=5

AND WCategory='1'

  ,'Due Soon'

,if(FirstSortedValue(DueIn,-%DateKey)>=0

  AND FirstSortedValue(DueIn,-%DateKey)<=14

  AND WCategory='2'

  ,'Due Soon'

  ,if(FirstSortedValue(DueIn,-%DateKey)>=0

  AND FirstSortedValue(DueIn,-%DateKey)<=30

  AND WCategory='3'

  ,'Due Soon','Seen in Time')))),

DueIn,%DateKey)

whereby I assume that DueIn and %DateKey are the needed dimensions for it.

- Marcus