Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am having an issue getting an if statement to work for one of the variables I have set up.
I am basically creating a drop down for days of the week and then want to show a count of a field when selected.
When I use one variable I can get it to work such as below, but when trying a few it wont work. Anyone know what I am doing wrong and how it can be resolved ?
Working currently :
if(vdaydropdown = 'Mon', Count (MVT), Day_name = 'Mon')
Attempt that wont work:
if(vdaydropdown = 'Mon', Count (MVT), Day_name = 'Mon',
if(vdaydropdown = 'Tue', Count (MVT), Day_name = 'Tue',
if(vdaydropdown = 'Wed', Count (MVT), Day_name = 'Wed',
if(vdaydropdown = 'Thu', Count (MVT), Day_name = 'Thu',
if(vdaydropdown = 'Fri', Count (MVT), Day_name = 'Fri',
if(vdaydropdown = 'Sat', Count (MVT), Day_name = 'Sat',
if(vdaydropdown = 'Sun', Count (MVT), Day_name = 'Sun' )))))))
if(vdaydropdown = 'Mon', Count (MVT), Day_name = 'Mon')
Will return Count(MVT) when vdaydropdown is set to 'Mon', and in all other cases, will return either true or false depending on what the condition Day_name - 'Mon' evaluated to.
Perhaps you're thinking of something like
Count({< Dayname = {'Mon'} >} MVT)?
This doesn't look like a valid set of nested if() statements and it doesn't seem to have any logical flow to it either - in this scenario, even if it worked, the result for any day selected would be Count(MVT)?
The syntax for nesting if() statements would typically be something like
If(Condition,When_True, //Else
If(Condition2,When_True2, //Else
If(Condition3,When_True3, When_All_False)))
I am new to Qlicksense so might be wrong the way i am writing it. I am trying to say when my variable is set to Mon then count(Mvt) where the field that is behind the variable is also to Mon. Is there a need to include the final clause?
if(vdaydropdown = 'Mon', Count (MVT), Day_name = 'Mon')
Will return Count(MVT) when vdaydropdown is set to 'Mon', and in all other cases, will return either true or false depending on what the condition Day_name - 'Mon' evaluated to.
Perhaps you're thinking of something like
Count({< Dayname = {'Mon'} >} MVT)?
Yes that is working for me. Thanks for your help.
A quick one so im not returning with a similar question , When square brackets are used can you just filter out/In conditions after using an aggregate function.