Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
siddharth_s3
Partner - Creator II
Partner - Creator II

Valuelist inside IF

Hi,

I am trying to use a dimension like below in a chart but the if condition is not displaying the valuelist dimension:

=IF(GetSelectedCount(SomeDim)=0,Legal_Entity_ID,ValueList('Tx','NTx'))

My measure is :

=IF( ValueList('Tx','NTx')='Tx',Variable1,Variable2)

Now, even if I am selecting the "SomeDim", the if condition is still displaying "somedim" and not the Valuelist

Labels (2)
7 Replies
sunny_talwar

Would you be able to share a mock up application where we can see the issue?

siddharth_s3
Partner - Creator II
Partner - Creator II
Author

Hi Sunny,

Sorry for the late response. Attached is a sample app.

 

@sunny_talwar 

sunny_talwar

You are right, seems like a bug to me... Will give this a shot in QlikView to see if I see the same behavior or not

sunny_talwar

I am not sure if this will work for you or not, but what you were trying to do with the ValueList() can be done using a Island Table... I have tried to implement this

IslandDim:
LOAD * INLINE [
IslandDim
First
Second
];

Dimension

=IF(GetSelectedCount(Dim) = 0, Dim, IslandDim)

Measure

If(GetSelectedCount(Dim) = 0, Sum(Measure),
IF(IslandDim = 'First', SUM({<[Dim2] = {'z'}>} Measure), 
IF(IslandDim = 'Second', SUM({<[Dim2] = {'y'}>} Measure))))
siddharth_s3
Partner - Creator II
Partner - Creator II
Author

Thank you Sunny. Yeah, I had already done it using the island table method. Was wondering why valuelist does not seem to work.

sunny_talwar

Not entirely sure of why the ValueList doesn't work.

tresesco
MVP
MVP

If not greatly mistaken, I have noticed this behavior in the past. It seems to me that it might not be a bug, but by-design valuelist/valueloop functions are such. Can't really explain the behavior entirely, but it could be something related to - 'scope of evaluation' , i.e. - it is probably evaluated before  the actual expression gets evaluated, somewhat similar to $ sign expansion. And you can really not associate it with the data model, since they are NOT associated.

May be @hic , @rwunderlich  can help on this here.