cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
chriser Frequent Visitor
Frequent Visitor

Average monthly value per invoice with multiple line items per invoice

Hi all, 

 

I have the following table:

 

InvoiceDate     InvoiceNumber     InvoiceLineItem     InvoiceLineItemValue     InvoiceTotalValue

01/01/2019     1                            A                            £20                                 £100

01/01/2019     1                            B                            £30                                 £100

01/01/2019     1                            C                            £50                                 £100

02/01/2019     2                            D                            £40                                 £40

03/10/2019     3                            E                            £60                                  £200

03/01/2019     3                            A                            £20                                 £200

03/01/2019     3                            F                            £120                                £200

etc...

 

I would like to create a simple Clustered Column Chart, where I can show Average Invoice Value by InvoiceDate (Year, Quarter, Month, Day).

 

Thanks!

2 REPLIES 2
Super User IV
Super User IV

Re: Average monthly value per invoice with multiple line items per invoice

@chriser best practice is to add a calendar/date dimension in your model, there are many post on how to add one either using DAX or Power Query.

 

- set relationship on date from date diemsnion with your invoice table

- add new measure called AVERAGE( Invoice[InvoiceTotalValue])

- add bar chart, put Year-> Quarter ->Month->Date on x-axis and average measure on value

 

now you can drill up and down to each level and see the average by invoice.






Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





chriser Frequent Visitor
Frequent Visitor

Re: Average monthly value per invoice with multiple line items per invoice

Thanks @parry2k, if I understand your answer, the problem with AVERAGE formula is that it will average all InvoiceTotalValues but it will count all of them per each InvoiceLineItem.

 

In my example if I have multiple invoices per day with different InvoiceTotalValue, number of InvoiceLineItems will make a difference to the average, which will give me a wrong average.

 

For example:

InvoiceDate     InvoiceNumber     InvoiceLineItem     InvoiceLineItemValue     InvoiceTotalValue

01/01/2019     1                            A                            £20                                 £100

01/01/2019     1                            B                            £30                                 £100

01/01/2019     1                            C                            £50                                 £100

01/01/2019     1                            A                            £40                                 £200

01/01/2019     1                            B                            £60                                 £200

01/01/2019     1                            C                            £100                               £200

 

 

Average is 150

 

but for:

InvoiceDate     InvoiceNumber     InvoiceLineItem     InvoiceLineItemValue     InvoiceTotalValue

01/01/2019     1                            A                            £20                                 £100

01/01/2019     1                            B                            £30                                 £100

01/01/2019     1                            C                            £50                                 £100

01/01/2019     1                            A                            £40                                 £200

01/01/2019     1                            B                            £60                                 £200

01/01/2019     1                            D                            £80                                £200

01/01/2019     1                            E                            £20                                 £200

 

Average is: 157.14

 

So how do I get a real InvoiceTotalValue Average independant from how many InvoiceLineItems are per Invoice?

 

Thanks

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors