Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rougeherring
Contributor III
Contributor III

Set Analysis Error - Setting value when no selections are made

I need to set a value when a selection has not been made. There is something wrong with this statement but I cannot figure out what:

Target Output if no selections have been made: (Sum{<[Multi Outlet]='Total US - Multi Outlet'>}[DS Sales])

Target Output if selections have been made: (Sum{<[Multi Outlet]=Selected>}[DS Sales])

My set analysis that is erroring out: Sum({$<[Multi Outlet] = {$(=If(GetSelectedCount([Multi Outlet])=0,'Total US - Multi Outlet',[Multi Outlet]))}>}[DS Sales])

Labels (1)
1 Solution

Accepted Solutions
inspari_dfg
Partner - Contributor III
Partner - Contributor III

You are getting an error because you can't do a IF-statement inside a set analysis.

However, you can do it, if you put your if-statement in a variable - let's call that variable v_NoSelection with the value:

If(GetSelectedCount([Multi Outlet])=0,'Total US - Multi Outlet',[Multi Outlet])

Then your final expression will look like this:

Sum({$<[Multi Outlet] = {"$(v_NoSelection)"}>}[DS Sales])

View solution in original post

2 Replies
inspari_dfg
Partner - Contributor III
Partner - Contributor III

You are getting an error because you can't do a IF-statement inside a set analysis.

However, you can do it, if you put your if-statement in a variable - let's call that variable v_NoSelection with the value:

If(GetSelectedCount([Multi Outlet])=0,'Total US - Multi Outlet',[Multi Outlet])

Then your final expression will look like this:

Sum({$<[Multi Outlet] = {"$(v_NoSelection)"}>}[DS Sales])

sunny_talwar

You can also try this

=If(GetSelectedCount([Multi Outlet])=0,
  Sum({$<[Multi Outlet] = {'Total US - Multi Outlet'}>} [DS Sales]),
  Sum([DS Sales])
)