Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
apoorvasd
Creator II
Creator II

Dynamic Labels for bar chart

Hello Everyone,

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?

Thank you.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

This?

=If(GetSelectedCount(WeekShort) OR  GetSelectedCount(POPER_NEW), If(Max(WeekShort)<MonthStart(Today()), 'Thereof BB','Risk BB'), 'Your Suitable message')

View solution in original post

15 Replies
swuehl
MVP
MVP

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.

apoorvasd
Creator II
Creator II
Author

Hi Stefan,

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.

Thank you.

swuehl
MVP
MVP

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

GetFieldSelections(WeekShort)>=month(Date#(WeekShort,'MMM'))


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.

apoorvasd
Creator II
Creator II
Author

GetFieldSelections(WeekShort)>=month(Date#(WeekShort,'MMM'))


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!

Thanks.

swuehl
MVP
MVP

I've understood you are looking at the label expression.

But where in

GetFieldSelections(WeekShort)>=month(Date#(WeekShort,'MMM'))

are you checking against current month?

apoorvasd
Creator II
Creator II
Author

Current and future months

swuehl
MVP
MVP

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

apoorvasd
Creator II
Creator II
Author

Okay, thanks for those hints Stefan!

I will look into them.

tresesco
MVP
MVP

May be this?

=If(GetSelectedCount(WeekShort), If(Max(WeekShort)<MonthStart(Today()), 'Thereof BB','Risk BB'), 'No WeekShort is Selected')