I would like to have a dynamic labels for my chart. What I mean is, when I select a week or a month which is less than current month, then the label should display, "Thereof BB" and if the month or week selected is greater than or equal to current month then the label of the bar should display ,"Risk BB" . With the below mentioned expression I am getting to work this except that, when I select more than one past or future month, it is not working.
=if(GetFieldSelections(WeekShort)>=month(Date#(WeekShort,'MMM')) or Month(Date#(POPER_NEW, 'MMM'))>=month(today())
,'Risk BB' ,if(GetFieldSelections(WeekShort)<month(Date#(WeekShort,'MMM')) or Month(Date#(POPER_NEW, 'MMM'))<month(today()) ,'Thereof BB', 'Thereof BB'))
Any help on this?
Solved! Go to Solution.
I think the GetFieldSelections() is probably the part that creates the issue for you.
But I don't understand this part really, why are you comparing WeekShort selections to WeekShort?
Is this the field you are making selections in? And are you using one of these fields as dimension in your chart?
A small sample might help to understand your issue.
Yes, WeekShort is the field in which selections can be made which has date as its values. Based on the date that a user selects in this field it should check if the date belongs to current or past months, that's the reason i have provided that condition.
I have attached sample files.
Given your sample QVW, what do you expect to see when you do some selections in WeekShort (for example, when selecting Oct in POPER_NEW, what should I select in WeekShort? And what do you expect to see in your chart?)?
Looking at this part or your label expression
Why are you using the month() function on your WeekShort date (and why are you using Date#() interpretation here, and in addition why with an incompatible format code?)?
I don't really understand what you are trying to do here.
In this expression, I am just trying to check if the month in the selected WeekShort is greater than or equal to current Month.
So when there is a selection made in WeekShort, it should check which month it belongs to and based on that the label of the bar graph should change. Ignore the expression for the bars, i want a solution for labels. I think I have explained what I want in my original post. Hope you can help me!
I've understood you are looking at the label expression.
But where in
are you checking against current month?
Seems like we have an ongoing communication problem, sorry for that. I am out of this discussion.
Just some general hints:
- WeekShort is already a date value. No need to interpret it using Date#().
- Month(WeekShort) is returning the unique month of the unique date value as a single dual value (text and number)
- If you select more than one WeekShort value from different months, Month(WeekShort) will return NULL
- GetFieldSelections() will return a comma separated string of the dates and you are comparing this to a single month value