BusinessObjects Board

Max Date-> Data qualification is greyed->Disabled filt

Hello,

Could you please help with following Bo 5 problem?

BO query (snapshot attached) generates for each Account list of all Orders and their OrderDates. For each Account I need to get the last (the biggest) OrderDate.

For this I used new variable Last Order Date=Max() In ().

For some reason by typing this formula the Definition tab with Qualification (Dimension, Measure, Detail) becomes inactive (greyed). So I can not choose whether this is Demension or Measure. But the icon assigned to it is pink (Measure).

I want to filter out the Last orders of each account only, but I am not allowed to do it, because all other variables associated with the previous one are of the same qualification (greyed) and filtering is disabled.

I appreciate any help on this!
Ondrej
BOissue.zip (105.0 KB)


ovyhnal (BOB member since 2007-08-13)

Hi, Welcome to B:bob:B! Your question is a fairly frequent one, and as a result it is in our “FAQ”. Look for the option about filtering on aggregate functions (like sum or max).


Dave Rathbun :us: (BOB member since 2002-06-06)

Ok, thanks a lot!

Now I know that filtering on Sum function is really not working in BO.
Is there any other solution how I can filter out orders with last order date?
I mean except of returning data directly from the query.

And I have nothing to filer on before I calculate last order date.

Thanks a lot
Ondrej


ovyhnal (BOB member since 2007-08-13)

Hi Ondrej,

How about the trick with the ranking?

Create a flag that will give you 1 for each account and order_date where order_date = max(order_date) and 0 for all other dates. Then do a rank of account ID object based on this flag and show only top 1.

Will this work?


Marek Chladny :slovakia: (BOB member since 2003-11-27)

Hi Marek,

Thanks a lot for your tip with ranking. However I still had no luck with it.

I am not much familiar with ranking but as far as I understood it selects top (resp. bottom) x records from selected object.

In any case number of rows I work in my report with is round 300 000 and this x value is max 1000.

Is there any other method?
Thanks a lot

Ondrej


ovyhnal (BOB member since 2007-08-13)

Hi Ondrej,

The ranking ranks a dimension based on values of a measure you select in the dialog.

As I wrote previously - create a flag that will have only 2 values. Either 1 (for the account IDs where order date = max(order date) ) or 0 for all other dates.

Now do ranking of based on the values of this new flag and select TOP 1 - it means it will filter only the records where flag has value 1. All records where flag=0 should be filtered out.

It means regardless of the number of records you have in the report the flag has only 2 values (0/1) and TOP 1 ranking is always possible.

I hope it is a little bit more clear 8)


Marek Chladny :slovakia: (BOB member since 2003-11-27)

Hi Marek,

That’s exactly what I did. But as you see in the attached screenshots it doesn’t work.

It is very strange, any help is appriciated very much!
Thanks

Ondrej
Ranking.zip (76.0 KB)


ovyhnal (BOB member since 2007-08-13)

How is the flag defined?

Try the following formula for the flag:

=(If (<Order Date> = (Max(<Order Date> In  Body In  Body) In <Account ID>)) Then 1 Else 0) In (<Account ID> , <Order Date>)

Did that help?


Marek Chladny :slovakia: (BOB member since 2003-11-27)

Hi Marek,

When I used this magical formula ranking worked - many thanks!

But how it comes that 2 different formulas generating same results are not same in terms of ranking the numerical results?

Is there any genaral principal of what formulas should be used in association with ranking or other features?

What I did was much simplier and obviously not sufficient:
=If(=Max() In ()) Then 1 Else 0

I would be glad if you could explain mystery of your formula e.g. “In Body In Body” etc…

Have a nice day (:


ovyhnal (BOB member since 2007-08-13)

It is very likely due to the calculation context in which the formula/variable is used in the report.

I am not sure about such principle. However I can share with you my approach in building formulas:

When I suggested you the solution I had created a simple report with accounts and dates - very simple 2-columns report, just to test what I was doing. At the beginning I created the flag with the same formula as you:

=If (<ORDER_DATE> = Max(<ORDER_DATE>) In <ACCOUNT_ID>) Then 1 Else 0

and the RANK 1 did not work.

So I put the formula (not the flag variable) into the column and went to menu Data -> Define as Variable and here I selected the option “Evaluate the formula in its context”. So BO knew what the context of my original formula was and created a new formula in its context. Then I defined the flag with this new formula and it worked.

So there is no mystery in it after all, I just used what BO provided me with :slight_smile:


Marek Chladny :slovakia: (BOB member since 2003-11-27)

Diky moc Marku! Moc jsi mi pomohl.

I assumed that you are Czech from your name. For the case you don’t speek Czech:

Thanks a milion! This is extremly useful new knowledge. Thanks for sharing it.

Have a good times in Jamaica!
Ondrej


ovyhnal (BOB member since 2007-08-13)

Ondrej,

Niet zac (you are welcome) 8)

I can speak Czech but I am Slovak :mrgreen:


Marek Chladny :slovakia: (BOB member since 2003-11-27)