Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
blue_louie_44
Partner
Partner

Using Only function in a table

Hi - I'm currently storing expressions in an excel file. In this excel file I have 3 fields... Bar, Sub, Expression.

There is only 1 expression value per Bar/Sub combination.

In the excel file in the Expression field e.g. I have Sum(Sales) for Bar value "A" and Sub value "1". I then have Sum(Costs) for Bar Value "B" and Sub value "1". (I've simplified things here - I can't send a screenshot because of the nature of the company I'm working for.

I load in this expressions file and create a table with Dimensions Bar and Sub. What I would like to do is evaluate the expression stated in field "Expression". So first row in the table would evaluate Sum(Sales) and second row Sum(Costs)..assuming the table is sorted on Bar.

I initially thought $(=Only(Expression)) would work as each row would only have 1 expression value, but this isn't the case. The formula does work when I select 1 "Bar" value.

How can I get the only function to evaluate for a full table of records?

Labels (1)
4 Replies
dilipranjith
Partner
Partner

dont understand the full scenario but Only function will work only if there is 1 value to be returned for the dimension combination.

why not just as the field you are using for only as a dimension?

e.g.  in below case Only(category) will not work becase prod1 is in 2 categories

ProdCategory
Prod1X
Prod1Y
Prod 2X

 

blue_louie_44
Partner
Partner
Author

Thanks. I think the issue is I would like to evaluate a different expression for each row in the same table. I get that Only() function won't allow me to do this so was looking for work-arounds. It's actually going to be a bar chart where I use this functionality too. In the bar chart I want different bars to be calculated on completely different expression values.

dilipranjith
Partner
Partner

i think you will either need to use if statements in measure. 

eg if(CustomerCountry='USA',Sum(OrderRecordCounter), Sum(LineSalesAmount))

or if the dimensions are static you could use valuelist

rwunderlich

I think you need double dollar signs. One to substitute in the expression text, a second to evaluate the expression.

$($(=Only(Expression)))

-Rob