Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
nicanova
Contributor III
Contributor III

GetObjectField - Error in Expression

I have a visualization with several alternative dimensions to show the breakout of our current employees by different combinations of demographic fields (stacked bar chart). I have one container object that is raw values, and I'm creating another that shows percentage (e.g., what percentage of our Individual Contributors or other job levels are male v. female). 

I found another post that made me think that a measure to dynamically calculate percentages as alternative dimensions are selected could use GetObjectField in the denominator:

sum([Headcount_CMY])/sum(total <$(=GetObjectField())> [Headcount_CMY])

but it keeps giving me an error: '>' expected

any suggestions?

Labels (4)
2 Replies
Chirantha
Support
Support

It looks like there might be a syntax error in your expression. Try removing the equal sign before GetObjectField() and see if that resolves the issue

sum([Headcount_CMY])/sum(total <$(GetObjectField())> [Headcount_CMY])
 

nicanova
Contributor III
Contributor III
Author

Thanks, I don't have any errors in the formula editor now! I am running into an issue with undefined values, I think because I have cross-sections of demographic fields that don't have breakouts (e.g., everyone who didn't declare their generation also didn't declare their gender). Any suggestions on how to make sure it's not trying to divide by 0?

ETA: This formula doesn't error out, but it doesn't appear to work either, and not just because of dividing by 0. I dropped it in a pivot table to test and it doesn't return any values. My goal is for each row to total 100%.

nicanova_0-1689600056707.png