You are not logged in.

Dear visitor, welcome to Palo Community Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

  • "realquo" is male
  • "realquo" started this thread

Posts: 257

Date of registration: Mar 11th 2009

Location: Italy

Occupation: BI Consultant

  • Send private message

1

Friday, April 10th 2009, 4:49pm

Strings comparison with GE, GT,.. for CurrentMonth

Hi all,
I could not get out of a problem I have when trying to dynamically set a value depending on the month, compared to "CurrentMonth".

Here's the situation:
I was able to get the strings for
- the Month referenced by the palo.datac formula: using Palo.Ename and Palo.Eindex I can get e.g. 200903 as for March 2009
- the current month: using dateformat and NOW(), I can get 200904 as for April 2009

Now, it seems that using GE or GT to compare those strings does not work properly in my case, I don't know if it's a bug or I'm missing something. While the actual rule was more complicated, you find below an example to reproduce the behaviour in the Demo db:

1. in the Datatypes dimension, create the following members:
- Example (numeric)
- PaloEname (string)
- DateFormat (string)
The second and third are only for check purposes, see below

2. In the Sales cube, add this rules:

['Example'] = IF(ge(PALO.ENAME("Demo","Years",PALO.EINDEX ("Demo","Years",!'Years')),DATEFORMAT(NOW(),"\Y")),['Budget'],['Actual'])

the above is the important rue, the following ones are for check

['PaloEname'] = PALO.ENAME("Demo","Years",PALO.EINDEX ("Demo","Years",!'Years'))
['DateFormat'] = DATEFORMAT(NOW(),"\Y")

So, according to first rule, I should get Budget if the month is in the future, and Actual if it is in the past, but now paste a view like the attached one (I manually entered values in Actual and Budget since my db was empty): you can see that, while the members PaloEname e DateFormat are properly filled, "Example" always get the same value (Actual). Practically the second element in the comparison is always evaluated greater than the first. X(

I also tried to compare using value(..) instead of comparing the strings but it worked even worse.

Any suggestion?

Thanks in advance,

RQ

  • "realquo" is male
  • "realquo" started this thread

Posts: 257

Date of registration: Mar 11th 2009

Location: Italy

Occupation: BI Consultant

  • Send private message

2

Wednesday, April 15th 2009, 10:33am

anyone from Palo on this

Anyone from the Palo team on this?

Thanks in advance,

RQ

  • "h_decker" is male

Posts: 763

Date of registration: Oct 26th 2005

Location: Cologne, Germany

  • Send private message

3

Wednesday, April 15th 2009, 2:14pm

RE: anyone from Palo on this

Hi,
did you try

['Example'] = IF(PALO.ENAME("Demo","Years",PALO.EINDEX ("Demo","Years",!'Years'))==DATEFORMAT(NOW(),"\Y"),['Actual'],['Budget'])

intead of

['Example'] = IF(ge(PALO.ENAME("Demo","Years",PALO.EINDEX ("Demo","Years",!'Years')),DATEFORMAT(NOW(),"\Y")),['Budget'],['Actual'])

?

Or how about

['Example'] = IF(PALO.ENAME("Demo","Years",PALO.EINDEX ("Demo","Years",!'Years'))==STR(DATEFORMAT(NOW(),"\Y"),4,0),['Actual'],['Budget'])

Or maybe >= operator works...didn't test it so far

Holger

  • "realquo" is male
  • "realquo" started this thread

Posts: 257

Date of registration: Mar 11th 2009

Location: Italy

Occupation: BI Consultant

  • Send private message

4

Wednesday, April 15th 2009, 5:42pm

still not working

Hi Holger,

thanks for your suggestions, unfortunately both don't work for me:
- the first always returns the value in 'Budget'
- the second (modified as follows in order to eliminate the "str wrong data type" error):
['Example'] = IF(PALO.ENAME("Demo","Years",PALO.EINDEX("Demo","Years",!'Years')) == STR(VALUE(DATEFORMAT(NOW(),"\Y")),4,0),['Actual'],['Budget'])
returns 'Budget' value as equal.

I also tried with >=, GT, LT, etc, but either I always got 'Budget' value or I always got 'Actual' values, I'm not able to get a different value depending on the Year I'm refereincg.

Any further help will be highly appreciated,

RQ

  • "h_decker" is male

Posts: 763

Date of registration: Oct 26th 2005

Location: Cologne, Germany

  • Send private message

5

Wednesday, April 15th 2009, 6:11pm

RE: still not working

How about using

STR(!'Years',4,0)

instead of

PALO.ENAME("Demo","Years",PALO.EINDEX ("Demo","Years",!'Years')

I used to use the second expression too but the first one is much more simple and also works....and maybe brings the solution for your issue?

Holger

P.S: I can see that you checked it on consolidated level. Does it behave the same way on base level e.g. Italy, Jan, Desktop L?

====>Another Edit:

You now what. Think I got it. When comparing with >= GT, e.g.
we NEED numeric stuff!!!!!!!! so it should be
like

['Example'] = IF(ge(VALUE(!'Years'),VALUE(DATEFORMAT(NOW(),"\Y"))),['Budget'],['Actual'])

Please tell me it works. Otherwise I am out of ideas for now :-)

This post has been edited 3 times, last edit by "h_decker" (Apr 15th 2009, 6:19pm)


  • "realquo" is male
  • "realquo" started this thread

Posts: 257

Date of registration: Mar 11th 2009

Location: Italy

Occupation: BI Consultant

  • Send private message

6

Friday, April 17th 2009, 12:00pm

got it!

Finally I did it! Don't ask me what's the difference with the first version, but now the calculations are properly handled... here's the solution:


['Example'] = IF(ge(PALO.ENAME("Demo","Years",PALO.EINDEX ("Demo","Years",!'Years')),DATEFORMAT(NOW(),"\Y")),['Budget'],['Actual'])

STR(!'Years',4,0) does not work for me (he says "wrong data type for the STR function).
Actually I initially tried to compare VALUES (even if GE should work with strings too, according to the manual...) instead of strings but VALUE(DATEFORMAT(NOW(),"\Y") used to return 0... Now also this returns the proper value so also this solution would work.

In a sentence, a strange false problem that made me (and you) loose some time, leaving me someway puzzled about the reliability of the rules engine...

Thanks again, regards,

RQ

  • "h_decker" is male

Posts: 763

Date of registration: Oct 26th 2005

Location: Cologne, Germany

  • Send private message

7

Friday, April 17th 2009, 12:11pm

RE: got it!

Hi,
good to hear it works now but

very strange :-) Indeed I can see no difference between
['Example'] = IF(ge(PALO.ENAME("Demo","Years",PALO.EINDEX ("Demo","Years",!'Years')),DATEFORMAT(NOW(),"\Y")),['Budget'],['Actual'])

and

['Example'] = IF(ge(PALO.ENAME("Demo","Years",PALO.EINDEX ("Demo","Years",!'Years')),DATEFORMAT(NOW(),"\Y")),['Budget'],['Actual'])

:-))

Try substitue PALO.ENAME("Demo","Years",PALO.EINDEX ("Demo","Years",!'Years')
with
STR(VALUE(!'Years'),4,0).

This should work and is a little shorter.

May it was a rule cache issue and it just worked after restarting the service.

Have a nice weekend.

Holger

  • "realquo" is male
  • "realquo" started this thread

Posts: 257

Date of registration: Mar 11th 2009

Location: Italy

Occupation: BI Consultant

  • Send private message

8

Friday, April 17th 2009, 1:05pm

not sure what is happening

Very strange indeed, the very same rule is no longer working at this moment (and value(dateformat(....)) now returns 0 again). I can't figure out what's happening... I'll update the post when I catch some interesting info...

Update: I found that a more general problem occurs when handling comparisons... I posted a new more general thread under this section.

________________________________________________________
Update as of 20 apr 2009: it seems that a more general problem exists while using comparisons among Measures, please see the following thread: http://www.jedox.com/community/palo-foru…p?threadid=1554

It was recognized as a bug.

This post has been edited 3 times, last edit by "realquo" (Apr 21st 2009, 5:18pm)


Rate this thread