Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
chris1987
Contributor

Only within Only function and Set Anaysis in general

Morning,

I wondered if anyone can help with this function. I'm trying to embed an only() within an only() to get the correct MonthName.

I'm trying to first select the MonthID of todays date, minus 3 months, which is 24229. I can get this by using the following function:

 

=only({1<DateID={'$(=num(today())-1)'}>}[MonthID])-3

I now want to get the MonthName which is associated to this MonthID, so I'm trying to embed the Only() function within another:

 

 

=only({<[MonthID]={$("=only({1<DateID={'$(=num(today())-1)'}>}[MonthID]-3"))}>}[MonthName])

But this is producing an error.

Please can someone help me correct the above, but it would also be very helpful if you could also point me in the direction of some documentation about how to hand functions in set anaysis. I'm self taught in Qlikview and always end up asking where to put the $ or whether to use "" or '. The functions aren't an issue to me, it's the syntax! It would be good to have an understanding of how these work

Cheers

Chris

 

1 Solution

Accepted Solutions
Partner
Partner

Re: Only within Only function and Set Anaysis in general

Try this:

=only({<[MonthID]={$(=(only({1<DateID={$(=num(today())-1)}>}[MonthID])-3))}>}[MonthName])
3 Replies
Partner
Partner

Re: Only within Only function and Set Anaysis in general

Try this:

=only({<[MonthID]={$(=(only({1<DateID={$(=num(today())-1)}>}[MonthID])-3))}>}[MonthName])
MVP
MVP

Re: Only within Only function and Set Anaysis in general

It might be as simple as this:

Only({<DateID = {$(=today()-1)}>} MonthName)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
chris1987
Contributor

Re: Only within Only function and Set Anaysis in general

Thanks,

I actually got it figured out but using:

=only({1<[MonthID]={$(=only({1<DateID={'$(=num(today())-1)'}>}[MonthID]-3))}>}[MonthName])

Thinking that I needed the apostrophe, but after testing your code I didn't

Thanks again for the reply.