Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Qlik community
In the attached file, I am trying to create a dynamic label. I have tried to apply it to the left most label "Direct Product contribution". What I want it to show:
The label should show the text "Direct Product Contribution" and then also the month that the user has selected in the month list box above and "YTD". This works exactly the way I want it when the user only selects one single month. So, for instance, if the user chooses Mar, the label will read "Direct Product Contribution Mar YTD". However, when the user selects Jan, Feb and Mar, the label reads "Direct Product Contribution Jan , Feb, Mar YTD". Of course, I only want it to read "Direct Product Contribution Mar YTD".
I am using the getfieldselections command. And I want it to only display the latest selection (in this case Mar). I thought about Rangemax(getfieldselections(Month) etc. but this is not yielding the expected result.
Your help is most appreciated 🙂
Kind regards
Christoffer
Try something like
='Direct Product Contribution' & FirstSortedValue(DISTINCT Month,-Month)
Hi Stefan
once again, you save the day :-). Can I up the question by one more item?
Now that I am successfully showing the "latest" month, I would like to add the year as well, so that it reads "Product Contribution Mar 2015 YTD".
After I tried your suggestion, which worked like a charm, I tried adding on the year by doing this:
='Direct Product Contribution' & FirstSortedValue(DISTINCT Month,-Month)&FirstSortedValue(DISTINCT Year,-Year)
and as that didn't work, I tried this:
='Direct Product Contribution' & FirstSortedValue(DISTINCT Month,-Month)&getfieldselection(Year).
But for some reason, the formula rejects the year...
Do you know what to do in this case?
Kind regards
Christoffer
Hi Try :
=MaxString(Month)
='Direct Product Contribution' & FirstSortedValue(DISTINCT Month,-Month)&FirstSortedValue(DISTINCT Year,-Year)
worked for me.
or
='Direct Product Contribution' & FirstSortedValue(DISTINCT Month,-Month)& Max(Year)
Hello Stefan,
you're right, now it worked for me as well. I probably misspelled something.
Thanks a lot 🙂
Kind regards
Christoffer
Also very good. It seems that there are often multiple sollutions to a Qlikview problem.
Thanks a lot Ido Gridish
Kind regards
Christoffer