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

IF CONDITION IN A LABEL

Hello,

I want in an expression label to have different label according to the if condition like the following sample

           company1                            company2                             company3

17/3/2017    18/3/2016         17/3/2017    20/3/2015          17/3/2017    18/3/2016

   2.000           3.000                 5.000           4.500                 2.500           4.000

I want in the label to display for the company2 the date 20/3/2015 because I compare the current date with the same date of 2015 and in the other companies I compare with the date of 2016

 

I put the following expression in the label of the expression for the previous period and returns -

IF(COMPANY_CODE='02', DATE(NUM(MAX({1}DATE_ID_HOURLY))-728),

DATE(NUM(MAX({1}DATE_ID_HOURLY))-364))

Do you have any idea how can I have the results that I want in the label ?

Thank you in advance.

 

5 Replies
Not applicable

Hi,

Please try below expression.

IF(COMPANY_CODE='02',DATE(MAX(DATE_ID_HOURLY)-728),

DATE(MAX(DATE_ID_HOURLY)-364))

Frank_Hartmann
Master II
Master II

please prepare a small sample which shows your problem, e.g. with scrambled and reduced data.

otherwise it will be hard to assist.

geogou1973
Creator
Creator
Author

Hello Frank

As you see in the following table I have 3 companies in a chart.

In the first expression I calculate the current sales by date and  in another expression the same date last year for the companies 1 and 3. In the company 2 I want to bring the sales of 2015 and I display correctly the results with two different variables. I want in the label to have for the company 1 and 3 the date 18/3/2016 and in the label of company 2 the date 20/3/2015. Is there any way to do this meaning to have dynamic label according to the dimension ?

Do the label expression recognize the if condition according to the dimension company ?

           company1                            company2                             company3

17/3/2017    18/3/2016         17/3/2017    20/3/2015          17/3/2017    18/3/2016

   2.000           3.000                 5.000           4.500                 2.500           4.000

geogou1973
Creator
Creator
Author

Hello Karan,

I have also used the same condition but it seems that in the label expression does not work the if condition with any field from the tables. I haven't found any other solution in order to have conditionally label.

Any other idea ?

Not applicable

Hello Geo,

Could you please share the sample data in the form of EXCEL/QVD, because for me IF condition is working in label expression.