Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

GetCurrentSelections()

I am trying to write an IF() that will return a value when a field within a group is selected. So I have something along the lines of whats below. However, the function is returning Sum(Sales) when any field in Annual Analysis is selected, not just 2015 YTD like I want. Any suggestions? Thanks in advance.

=IF(GetCurrentSelections([Annual Analysis]) = '2015 YTD', Sum(Sales)))

1 Solution

Accepted Solutions
sunny_talwar

Try this:

=If(WildMatch(GetFieldSelections([Annual Analysis]), '2015 YTD'), Sum(Sales))

View solution in original post

6 Replies
sunny_talwar

Try this:

=If(WildMatch(GetFieldSelections([Annual Analysis]), '2015 YTD'), Sum(Sales))

Not applicable
Author

Yes that worked! how does WildMatch work?

antoniotiman
Master III
Master III

If You haveDimension [Annual Analysis] in Your Group try

If(GetCurrentField(YourGroup)='Annual Analysis',Sum({<[Annual Analysis]={'2015 YTD'}>} Sales))

sunny_talwar

Not entirely sure what you are doing and how you data looks. if what ANTONIO‌ said did not work, would you be able to share a sample?

Best,

Sunny

Not applicable
Author

I spoke too soon, =If(WildMatch(GetFieldSelections([Annual Analysis]), '2015 YTD'), Sum(Sales)) worked. How does WildMatch work?

sunny_talwar

Here is an image from QV Help page:

Capture.PNG

I hope this will clarify things.

Best,

Sunny