Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am using a pick and match formula with a dimension (not a variable) and I'd like to show a default value if no value is picked.
$(=Pick(Match((Grouping1),'Option1',
'Option2')
,'[Option1]'
,'[Option2]'
))
I thought of something like:
if(Count(Grouping1)=1, $(=Pick(Match((Grouping1),'Option1',
'Option2')
,'[Option1]'
,'[Option2]'
)),Option1)
Anyone knows the right syntax for it?
How about this:
$(=if(Count(DISTINCT Grouping1) = 1, Pick(Match((Grouping1),'Option1',
'Option2')
,'[Option1]'
,'[Option2]'
), '[Option1]'))
or
$(=if(GetSelectedCount(Grouping1) = 1, Pick(Match((Grouping1),'Option1',
'Option2')
,'[Option1]'
,'[Option2]'
), '[Option1]'))
May be this
$(=Pick(Match((Grouping1),'Option1',
'Option2') + 1
,'[Option1]'
,'[Option1]'
,'[Option2]'
))
Hi Sunny,
Unfortunately it doesn't seem to work.
So, let me clarify this. The expression was working before you introduced this new requirement? So, essentially this was working?
$(=Pick(Match((Grouping1),'Option1',
'Option2')
,'[Option1]'
,'[Option2]'
))
That is indeed working, but only once I select Option 1 or 2 in my dropdown selection box.
Without a selection it is showing nothing. I want it to show option 1 by default as well.
Hello Jurien,
Trust that you are doing good!
Could you please try something like below?
$(=If(IsNull(Pick(Match((Grouping1),'Option1','Option2'),'[Option1]','[Option2]')),
'Default',
Pick(Match((Grouping1),'Option1','Option2'),'[Option1]','[Option2]')
)
)
Hope this will help.
Regards!
Rahul
How about this:
$(=if(Count(DISTINCT Grouping1) = 1, Pick(Match((Grouping1),'Option1',
'Option2')
,'[Option1]'
,'[Option2]'
), '[Option1]'))
or
$(=if(GetSelectedCount(Grouping1) = 1, Pick(Match((Grouping1),'Option1',
'Option2')
,'[Option1]'
,'[Option2]'
), '[Option1]'))
With a small tweak Sunny's approach should work:
$(=Pick(rangesum(Match((Grouping1),'Option1',
'Option2'), 1)
,'[Option1]'
,'[Option1]'
,'[Option2]'
))
to return the default-value of 1 even if Grouping1 returned NULL because there are more as one value possible and no aggregation is used.
- Marcus
I used the second option and it worked!
This doesn't seem to work, but I used Sunny's 2nd suggestion.