Discussion board where members can learn more about Qlik Sense App Development and Usage.
Let's say I am developing a sheet and on that sheet I am using a table visualization. In this table, I add a calculated field, let's say it's a calculated measure. I enter my expression and I see my measure being calculated accordingly. That's all fine.
Now, for an example I want to be able to color code the field based on its value. The only way I know how to do this is to put the exact same formula in the color expression statement, surrounded by some IFs. This totally works, but it has a few problems:
Is there a way that I can just reference the calculated field's value in the color expression? Something like:
=if($value > 0, green(), if($value < 0, red(), black())
And to be clear, this would be helpful for more than just the foreground color. It would also be useful for the background color and the URL link text for items that I display as URLs.
Hi @sunny_talwar, yes, this Column() function is significantly more scalable and solves most of the problems that I listed in my three bullet points of my original post. A few comments though:
With all of this in mind, is there also a function that you know of that addresses some of the challenges I listed above? (If not, the Column() function gets me 65% of the way there.)
- The Column() function only works on measures. What I described in my original post was a measure, however, I have run into scenarios where it would be helpful to do the same operation on dimensions, since I often also have calculated dimensions too
May be use GetObjectField for this one GetObjectField
- The Column() function takes a single argument, which requires me to know the order of my measures. Of course, this should never be too big of an issue since I am always the author of the entire table, but if I reorder the columns, and two measures switch order priority, then I now have to update the argument in the Column() function
You can address this by using Expression label instead of Column() function. So if you expression is labeled XYZ... you can use [XYZ] as the column reference
- Because the Column() function requires a single argument, I still can't copy and paste a color formula between multiple fields like I could if there were just a $value construct that I could leverage
I am not sure if this is possible... some level of human intervention will be needed. I guess if QlikView or Qlik Sense were to be able to do everything for us, then why would they need developers like us :). Jokes apart, I am not sure if this is possible, but may be @rwunderlich or @marcus_sommer might have an idea for this.
There is unfortunately, no "this" or "self" construct. I wish there were. So you effectively have to name the column either by name or number to reference it's value.