Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Partner
Partner

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
MVP & Luminary
MVP & Luminary

Re: Error in calculated dimension

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

Re: Error in calculated dimension

Could you post your sample application?

Re: Error in calculated dimension

May be this:

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

MVP & Luminary
MVP & Luminary

Re: Error in calculated dimension

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

Partner
Partner

Re: Error in calculated dimension

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
Contributor II

Re: Error in calculated dimension

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'))))

MVP & Luminary
MVP & Luminary

Re: Error in calculated dimension

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