Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Remove Credit Notes

Hi Everyone,

Just wondered if anyone can help with this one.

I need to be able to deduct credit notes from the overall invoices.

I have a table of invoices which may or may not have credit notes against them, see the credit note table.

I firstly need to take away the credit amounts from each of the columns relating to identical reference numbers. i.e deduct the credit notes from the invoice amounts.

I then need my table to bring back a count of only 1 overall to enable me to work out an average.

It's a little difficult to explain but effectively if I have 3 invoices and 1 credit note with the same reference I want the report to remove the credit values from the columns then to count only 1 as all the identical reference numbers relate to only one cost.

This will then enable me to work out the average costs.

Many Thanks

Kind Regards

Wendy

15 Replies
Anonymous
Not applicable
Author

Hi John,

OK Thanks your a star.

Hope you enjoy the celebrations.

Kind Regards

Wendy

Anonymous
Not applicable
Author

Sorry I meant to say Andrew

Just come off the phone from speaking to John

effinty2112
Master
Master

Hi Wendy,

In the tables you gave yesterday what is the expression you use?

If I understand you correctly you want to sum up the value of invoices (or is it the count of invoices?) without doubling the value up if the invoice ref crops up twice (or more).

If the ref appears in more than one month then to what month do you want the invoice value to be booked against?

Is the data set you posted earlier good representation of the one you're working on?

With the data already supplied check this table out for ref 10136.

Date DocType I Costs ID L Amount Other Other1 Pat Amount Pit Amount Ref Supplier
24/03/2016Invoice0 635.350 1554.44371.8210136N
29/04/2016Invoice0 00 148.55010136N
11/05/2016Invoice0 0404.55 0010136N
25/05/2016Invoice0 0404.55 0010136N
25/05/2016Invoice0 635.350 1554.44371.8210136N
Credit010019430404.5500010136 
Credit01001950635.35001554.44371.8210136

How would you like these figure to be aggregated and allocated to a month?.

We'll get there I'm sure Wendy.

Kind regards

Andrew

Anonymous
Not applicable
Author

Hi Andrew,

Hope you had a good celebration.

Thanks for coming back to me.  The expression I used was Count (Distinct Ref)

I want to count the number of Unique References regardless of the Month.  If it appears in more than one month I would like it to appear in the 1st month that it shows. 

I am trying to get an average cost by reference so if it appears more than once it will dilute the average if that makes sense.

In the table you have given as an example I would only want 1 count for Reference 10136 regardless if it is an Invoice or a Credit Note and would like it to appear in the March Month as this is the 1st month it appears.

I will then be able to divide the overall costs by the count of the references to obtain my result.

I hope this makes sense and thanks once again for your input on this.

Kind Regards

Wendy

effinty2112
Master
Master

Hi Wendy,

Hope this gets us closer to the solution. Add this piece of script to the end of your load script.

RefByEarliestMonth:

LOAD

Ref,

Month(Min(Date)) as EarliestMonth

Resident [All Docs] Group by Ref;

Looking at ref 10136 these are the associated records as in previous post less a couple of columns:

Date DocType L Amount Other Other1 Pat Amount Pit Amount Ref Supplier
24/03/2016Invoice635.350 1554.44371.8210136N
29/04/2016Invoice00 148.55010136N
11/05/2016Invoice0404.55 0010136N
25/05/2016Invoice0404.55 0010136N
25/05/2016Invoice635.350 1554.44371.8210136N
Credit0404.5500010136 
Credit635.35001554.44371.8210136

This straight table, there is one dimension Month(Date), is what you don't want:

=Month(Date) Count(DISTINCT Ref) Sum([L Amount]) Sum(Other) Sum(Other1) Sum([Pat Amount]) Sum([Pit Amount])
1906.05 1213.65 0 4811.87 1115.46
Mar1635.35001554.44371.82
Apr1000148.550
May1635.35809.101554.44371.82
1635.35404.5501554.44371.82

If you take out the calculated dimension Month(Date) and replace it with the field we made in our script the table becomes this, which looks promising as the figures tally with the totals returned above:

EarliestMonth Count(DISTINCT Ref) Sum([L Amount]) Sum(Other) Sum(Other1) Sum([Pat Amount]) Sum([Pit Amount])
Mar11906.051213.6504811.871115.46

If we clear the ref field we get this for the records in the data you posted:

EarliestMonth Count(DISTINCT Ref) Sum([L Amount]) Sum(Other) Sum(Other1) Sum([Pat Amount]) Sum([Pit Amount])
Jan5333772.113588.6758334790.9514511.29
Feb2826825.351939.32315.231894.212473.21
Mar2819411.634069.9269.2532809.148505.25
Apr2716925.81707.6747426903.137944.37
May2228072.01263.23012011.598985.63

These numbers look very different from the ones you posted, I'm hoping that's down to your actual data being different from what I'm working with.

Good luck

Andrew

Anonymous
Not applicable
Author

Hi Andrew,

I certainly think you are on to something with your solution above.

Not sure what I am doing wrong though as with my actual data I am getting the same answer as before, which I don't understand.

Any other ideas please?

Kind Regards

Wendy