Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Utop1984
Contributor III
Contributor III

Problem with ">" for date in expression

Hi everyone,

 

I have problem with the use of operande ">" with Dates.

Even if I can use it with numerics values, it doesn't work with dates for me.

I want sales after a certain year or between certain years

but :

 

Sum({$<[Date.autoCalendar.Year]={">2000"}>}SALES)

Or even :

Sum({$<[Date.autoCalendar.Year]={">2000<2019"}>}SALES)

 

Are not working...

 

But surprisingly :

Sum({$<[Date.autoCalendar.Year]={"2000"}>}Sales)

Is working and give me sales of year 2000

 

Also, I think my problem with the comparators "< and >" are only wih dates... I tried with other values that contains figures and it works...but it should work with years as well as it is one of the precise example on the "help" documents no ?

 

Do you have an idea where the problem can come from ?

Labels (2)
1 Solution

Accepted Solutions
treysmithdev
Partner Ambassador
Partner Ambassador

I don't see anything wrong with your expression. My guess is this has to do with it being a derived field. Here are a couple things I would do to test:

1. Create a filter pane with [Date.autoCalendar.Year] as the dimension. In the search box, if you enter '>2000', do the results match what you expect?

2. Try creating a field in your data model: Year(Date) as Year. Then try using that in your set analysis instead.

3. Try >=2001. This is a long shot but worth a quick try. 

Blog: WhereClause   Twitter: @treysmithdev

View solution in original post

2 Replies
treysmithdev
Partner Ambassador
Partner Ambassador

I don't see anything wrong with your expression. My guess is this has to do with it being a derived field. Here are a couple things I would do to test:

1. Create a filter pane with [Date.autoCalendar.Year] as the dimension. In the search box, if you enter '>2000', do the results match what you expect?

2. Try creating a field in your data model: Year(Date) as Year. Then try using that in your set analysis instead.

3. Try >=2001. This is a long shot but worth a quick try. 

Blog: WhereClause   Twitter: @treysmithdev
Utop1984
Contributor III
Contributor III
Author

Hi,

The filter pane didn't work (Always selected every years)... BUT : I added a new field as you said and I works.

Thanks a lot for your help. Nevertheless, surprised I doesn't work with "auto" fonction... This will force me to build lot of added field in the data base ...

But thanks a lot for your solution !!