Wiered CrossTab Variable Required

Hi,

I have a cross tab and the data sample is -

Account----2009-06-----2009-07-----2009-08----2009-09-----ProductionMonth
123---------- Null---------45.32--------Null----------Null-----------2009-03
456-----------Null---------35.02--------Null----------38.56---------2009-07
12345--------85.00-------45.10--------745---------21.01----------2009-03

Now the logic I need to build is:

  1. For the first record ProductionMonth = 2009-03, but no amount is received for 2009-06, 2009-08 and 2009-09 months. So that means the Account Charge is missing for these months and I want to display “Missing” in those cells instead of blank cells.

  2. Now for the second record, ProductionMonth = 2009-07, and we haven’t received amount for 2009-8, so I want to display “Missing” for that month. But I don’t want to display any thing for the month of 2009-06 as at that time, the account was not in existence.

Could some one please help me with the way to achieve the same at the report level.

Please let me know if my requirement is not clear, I will try my best to clarify it.

Edit - So my expected output is :

Account----2009-06-----2009-07-----2009-08----2009-09-----ProductionMonth
123--------Missing------45.32------Missing----Missing--------2009-03
456--------Null---------35.02------Missing-----38.56---------2009-07
12345------85.00--------45.10--------745-------21.01---------2009-03


aniketp :uk: (BOB member since 2007-10-05)

Obviously, you can test for the Nulls using a combination of If and IsNull and replace them with “Missing”, that part is fairly straightforward.

What in the data tells you that the account didn’t exist at that time?

If you have no way of knowing that, from your data, then what you are asking is impossible.


Mak 1 :uk: (BOB member since 2005-01-06)

Hi,

You can modify your query as NVL(value,0). So if the account exists for an year and there is no value 0 will be returned by the query.
Next in Infoview u can use if(value=0;‘Missing’;value+’’). Sisnce ‘Missing’ is a string so I have converted value to string as well.
If this doesnt work can you ask your costomer for displaying 0 instead of ‘Missing’? Sinc there is a datatype difference so I am not sure how crosstab will behave.


priyanka1410 :uk: (BOB member since 2007-01-13)

Thanks for your responses.

I was sure that it will confuse all. Let me take one specific example here:

Account–2009-06-----2009-07-----2009-08----2009-09-----ProductionMonth
456--------Null----------35.02-------Missing-----38.56---------2009-07

Here my Account Number = 456. And Production date is 2009-07. Now for 2009-08, the charge is null, so I want to display missing at that place.

Also the charge for 2009-06 is null, but this account was created in 2009-07(ProductionMonth), so it is but obvious that for 2009-06, the charge will come null, so I don’t want to change anything there.

But as the charge for 2009-08 is null and this account was created in 2009-07, that means I haven’t recevied any amount for this. so that means it is missing for that particular month.

Hope this time i am clear, if not please let me know…


aniketp :uk: (BOB member since 2007-10-05)

Again,

Is it production month?

If so you need to think about the logic, without data types e.t.c. I can only supply pseudo code…

If the production month<production date then field else missing


Mak 1 :uk: (BOB member since 2005-01-06)

ProductionMonth is the one which says when the account was created and Invoice Date year month is the one which says the charges per month received. And the formula I am using is -

=If([Invoice Date Year Month] >= "2009-07" And [ProductionMonthYear] = "2009-07" And IsNull([ChargeAmount]);"Missing";[ChargeAmount])

But it is showing Missing everywhere, but i want to see only if the invoice date year month is greated than production month. And the formula for productionmonth is:

=FormatDate([Production Date];"yyyy-MM")

aniketp :uk: (BOB member since 2007-10-05)

Ok, then wouldn’t you want something like:-

=If([Invoice Date Year Month] >= [ProductionMonthYear] And IsNull([ChargeAmount]);"Missing";[ChargeAmount])

Mak 1 :uk: (BOB member since 2005-01-06)

I tried that also, but it is also not working.

AS my Invoice Date Year Month is in some other format and for ProductionMonthYear, I am using some formula on ProductionDate:

=FormatDate([Production Date];"yyyy-MM")

aniketp :uk: (BOB member since 2007-10-05)

What is the error?

If tgeres no error do you get “missing” and the numerics correctly displayed?

Maybe it is the mixed data types is charge amount a numeric, you could trya Format Number on it to turn it into a character?

The logic, itself, seems quite sound to me.


Mak 1 :uk: (BOB member since 2005-01-06)

Mak thanks a lot for your prompt responses.

I think I am confusing you, let me try to put it again:
Formula for ProductionMonth:

=FormatDate([Production Date];"yyyy-MM")

InvoiceMonth is directly coming from datawarehouse in the format yyyy-MM.

Now I created a variable with the following code:

=If([InvoiceMonth] >= [ProductionMonth] And IsNull([ChargeAmount]);"Missing";[ChargeAmount])

Now this formula is giving write output. But it is giving “Missing” everywhere which is wrong. I need to show “Missing” word only if InvoiceMonth is greater or equal to ProductionMonth.

Example -
Account----2009-06-----2009-07-----2009-08----2009-09-----ProductionMonth
123---------- Null---------45.32--------Null----------Null-----------2009-03
456-----------Null---------35.02--------Null----------38.56---------2009-07
12345--------85.00-------45.10--------745---------21.01----------2009-03

Now here for Account = 456, 2009-06 is null and it should be null, as this account was created in 2009-07. So if after 2009-07 the charge is null, I need to show “Missing”, before that if there is null, I don’t want to touch that value.

Please let me know if again I am confusing. :frowning:


aniketp :uk: (BOB member since 2007-10-05)

Ok, well maybe its as simple as this:-

If([InvoiceMonth] >= [ProductionMonth];"Missing";[ChargeAmount])

Mak 1 :uk: (BOB member since 2005-01-06)

Mak this is what I am using till now. But I am getting “Missing” word everywhere. Even If the Invoice Month is less than Production Month , I am getting Missing word where I should not get.

And I guess this is happening because InvoiceMonth is not comparing with ProductionDate.

Here in report , InvoiceMonth = 2009-08(for an example) is coming directly from the datawarehouse.
Wherein ProductionMonth = FormatDate([Production Date];“yyyy-MM”) is a report level variable.

Please let me know if you have understood the concern.


aniketp :uk: (BOB member since 2007-10-05)

They are both character format, correct?

If so, I cannot think why this would not work and I’m not in a position to try it for myself, at the mo…


Mak 1 :uk: (BOB member since 2005-01-06)

InvoiceMonth is of characted data type. And for ProductionMonth i am using FormatDate(). So I guess it is also in Character(I am not sure FormatDate() output is in character or date format ). :frowning:


aniketp :uk: (BOB member since 2007-10-05)

FormatDate returns a character.

Maybe, you could try turning them into numerics, stripping out the “-” and comparing YYYYMM?

Other than that I’m stumped… :?


Mak 1 :uk: (BOB member since 2005-01-06)

I created three variables -

NumberInvoice =Replace([InvoiceMonth];"-";"")
NumberProduction =Replace([ProductionMonth];"-";"")

And the final variable is -

=If(([NumberInvoice] < [NumberProduction]) And IsNull([ChargeAmount]);[ChargeAmount];If(([NumberInvoice] >= [NumberProduction]) And IsNull([ChargeAmount]);"Missing";[ChargeAmount]))

But still whereever ChargeAmount is null, it is displaying “Missing” which is the major problem.

Please help. :blue: :blue:

Even I tried below formula, but no success:

=If(([NumberInvoice] >= [NumberProduction]) And IsNull([ChargeAmount]);"Missing";[ChargeAmount])

aniketp :uk: (BOB member since 2007-10-05)

Slight different way of looking at your problem:-

=If([InvoiceMonth]>=[ProductionMonth];[ChargeAmount];If(Isnull([ChargeAmount]);”Missing”))

As I say, I’m shooting in the breeze here, as I cannot test this…


Mak 1 :uk: (BOB member since 2005-01-06)

Hi,

I’m pretty sure you should compare numeric, so the way so far has been good.

One other thing to check, I see invoice month is a dimension or detail object (as it is in the across, but how about production-month?
For this to work both should be dimension (or detail).

Just a guess since if would have built the production month in the universe, I would have found the min() and then the object defaults to measure.
If its measure, but coming straight from the query, no problem, you can declare a dimension variable using the measure object.

You do see ‘missing’ everywhere right, so the combination of dimension objects are not really ‘not there’, only the measure is NULL.
Then you can also try the alerter approach, and create an alerter to replace the real value with the text ‘missing’…

Also you can try a two text if formula in the crosstab, just to see that it actually went trough the if and evaluated it to this side of the if.
Another step is put the actual test objects in the same crosstab,
so you can visually see what the test is comparing.

Just some debugging thoughts,
Hope you get it to work now,
Marianne


marianne :netherlands: (BOB member since 2002-08-20)

Mak1 I appreciate your responses and your help. And I do understand you can’t replicate this problem at your end. Once again I appreciate your thoughts on this issue.

I tried your code, but it is displaying nothing , means the values and nulls are displayed as it is:

=If([NumberInvoice] >= [NumberProduction];[ChargedAmount];If(IsNull([ChargedAmount]);"Missing"))
Where [NumberInvoice] = Replace([InvoiceMonth];"-";"")

Where [InvoiceMonth] is a character type dimension coming directly from universe and the values inside it are - 2009-01,2009-02,2009-03 and so on…

Also [NumberProduction] = Replace([ProductionMonth];"-";"")
Where [ProductionMonth] = FormatDate([Production Date];"yyyy-MM")

Where [Production Date] is a date type dimension coming from universe and values are in the format: MM/DD/YY.

Marianne, thanks for your suggestions.

InvoiceMonth is a character type dimension object in the universe and values are 2009-01,2009-02… and so on…

Could some one please provide me more feedback so that I can try to troubleshoot this problem at my end. Thanks in advance.


aniketp :uk: (BOB member since 2007-10-05)

I think Marianne, said in her above post, that you should be comparing Numeric values.

Try this and the various formulae that have already been discussed.

I can’t offer you any more on this, than has already been said, I’m afraid…


Mak 1 :uk: (BOB member since 2005-01-06)