Forum Discussion
Gazsim44
6 years agoHelper III
Add 'Order Raised' column
Hi, I have a report I am building which in basic form consists of a Job No, Invoice No and Invoice Date. There can be several invoice's on one job and then also several dates etc. Is there a way ...
- Anonymous6 years ago
To order on dates first, invoice number second:
[Order Raised] = COUNTROWS ( FILTER ( ALL ( 'Table' ), 'Table'[Job No.] = EARLIER ( 'Table'[Job No.] ) && ( 'Table'[Invoice Date.] < EARLIER ( 'Table'[Invoice Date.] ) || ( 'Table'[Invoice Date.] = EARLIER ( 'Table'[Invoice Date.] ) && 'Table'[Invoice No.] <= EARLIER ( 'Table'[Invoice No.] ) ) ) ) )
Gazsim44
6 years agoHelper III
Hi & many thanks,
This works fine but doesnt take into account the date? This does need to factored in before the invoice number as there are different sequences of numbers (for credit notes etc).
Sorry I should have stated this at the beginning,
Thanks again,
judspud
6 years agoSolution Supplier
Hi Gazsim44
Please see updated code to include the dates
Order Raised = VAR job = Table[Job No.]
VAR InvoiceDate = Table[Invoice Date]
VAR invoice = Table[Invoice No.]
return
CALCULATE(COUNTROWS(Table),FILTER(all(Table),STable[Job No.]=job && Table[Invoice Date]<= InvoiceDate && Table[Invoice No.]<=invoice))
Hope this helps
Thanks,
George
- Anonymous6 years agoNot applicable
To order on dates first, invoice number second:
[Order Raised] = COUNTROWS ( FILTER ( ALL ( 'Table' ), 'Table'[Job No.] = EARLIER ( 'Table'[Job No.] ) && ( 'Table'[Invoice Date.] < EARLIER ( 'Table'[Invoice Date.] ) || ( 'Table'[Invoice Date.] = EARLIER ( 'Table'[Invoice Date.] ) && 'Table'[Invoice No.] <= EARLIER ( 'Table'[Invoice No.] ) ) ) ) )- Gazsim446 years agoHelper III
Many thanks! 🙂
- Gazsim446 years agoHelper III
Hi George,
Thanks but doesnt seems to be quite right in terms of the results. Let me give you a live example based on this calculation;
Many thanks
Invoice No. Invoice Date. Job No. Order (based on calculated column) Correct Order 59202682 08/11/19 802690xxxx 3 3 52142778 07/11/19 802690xxxx 1 1 52143014 08/11/19 802690xxxx 2 2 52148123 05/12/19 802690xxxx 3 4 59203181 05/12/19 802690xxxx 5 5