Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a table that looks like:
Category | MyFlag | Amt |
---|---|---|
A | y | 20.00 |
A | y | 25.60 |
B | n | 30.32 |
C | n | 70.00 |
C | y | 9.10 |
I want a measure that computes the sum of the selected records where MyFlag='y'. E.g. if all five are selected the measure is 20+25.6+9.10. The expression I am using is Sum({$<MyFlag='y'>}Amt), but it always shows 0 (zero). Any ideas for what I'm doing wrong? The expression editor doesn't show any syntax errors.
Thanks
The correct Set Analysis statement should be this:
sum({$ < MyFlag = {'y'} > } Amt)
Notice the missing curly brackets in your statement .
The correct Set Analysis statement should be this:
sum({$ < MyFlag = {'y'} > } Amt)
Notice the missing curly brackets in your statement .
try this
=Sum( {<MyFlag ={'y'} >} Amt)
You mentioned about selection, if the sum needs to change based on selection, then I would try this:
=Sum({<Flag *= {'y'}>}Amt)
Thanks, but that didn't make any difference.
I had actually tried that earlier and it didn't work. When I tried it again didn't work initially. However, when I X'ed out my existing selections, then it worked.
Well this expression will give you 0 if you select Flag = n, whereas the one provided by others will continue to show you y rows even if you select Flag = n
Not sure if you want this or not
Good to know. I'm sure it will come in handy. Thanks.