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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Error in calculated dimension

Hello,

I am trying to use specific field values in my chart dimension.  I only want to use three out of one hundred. This is what I have for the Calculated Dimension right now, but it is erroring out:

=Only({$<descriptionMeasure={"*Total Net Interest*","*Other Income*","*Total Revenue*"}>}descriptionMeasure)

How can I select just three fields out of many to display as my chart dimension?

Thanks,

Frank

1 Solution

Accepted Solutions
sasiparupudi1
Master III
Master III

Try Like this

=Aggr(Only({$<descriptionMeasure={'*Total Net Interest*','*Other Income*','*Total Revenue*'}>}descriptionMeasure),descriptionMeasure)

hth

Sasi

View solution in original post

8 Replies
Qrishna
Master
Master

did you aggregate with respect to other dimensions of the chart?

try this:

AGGR(Only({$<descriptionMeasure={"*Total Net Interest*","*Other Income*","*Total Revenue*"}>}descriptionMeasure),OtherTableDimensions)

Not applicable
Author

There are no other dimensions to the chart. I want to use descriptionMeasure for the dimension, but I don't want all the values from descritpionMeasure, I want three specific ones. This chart will always be the same three descritpionMeasure fields and will cahnge according to region or business unit.

Qrishna
Master
Master

AGGR(Only({$<descriptionMeasure={"*Total Net Interest*","*Other Income*","*Total Revenue*"}>}descriptionMeasure),descriptionMeasure)



then try this. and let me know if that works


Thanks

krishna

Not applicable
Author

I think that the ONLY is not the right function to use.  If you had a field that contained values but only wanted to use a few for a dimension, what would you do?

Not applicable
Author

Kind of like this in SQL

Select myFieldValue

     from descriptionMeasure

where myFieldValue in ('Value1','Value 39','Value4237')

Qrishna
Master
Master

For calculated dimensions, you have to use only() function, but should be aggregated.

As Only() is the only non aggregate function where we can use set analysis to filter the field.

if calculated dimension is the only dimension in the chart then the Expression will be  Aggr(Only({Condition}FieldName),FieldName).

In your case:

Aggr(Only({$<myFieldValue = {'Value1','Value 39','Value4237'}>}myFieldValue)).

let me know if i answered your question.

Thanks

Kushal_Chawda

try below if you want to display wild card match

aggr(if(wildmatch(descriptionMeasure,'*Total Net Interest*','*Other Income*','*Total Revenue*'),descriptionMeasure),descriptionMeasure)

or for exact pattern match try below

aggr(if(match(descriptionMeasure,'Total Net Interest','Other Income','Total Revenue'),descriptionMeasure),descriptionMeasure)

sasiparupudi1
Master III
Master III

Try Like this

=Aggr(Only({$<descriptionMeasure={'*Total Net Interest*','*Other Income*','*Total Revenue*'}>}descriptionMeasure),descriptionMeasure)

hth

Sasi