Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
10 years ago
Solved

Count above average

I am pulling the Average Cost and Average Invoice Charge for a part.  My next column is how many times it occurred, which is 88 times.  I now need a column that tells me how many times the Invoice Charge was above the average.  How can I do this?

 

  • Depends on your data model.

     

    If you have a table of Products with Average Invoice Charge and another table with your Invoices, then you could link the two tables on something like Product ID and then add a calculated column or measure like:

     

    AboveAverage = CALCULATE(COUNTROWS(RELATEDTABLE(Invoices)),Invoices[InvoiceCharge]>Products[AverageInvoiceCharge]),

    Something like that.

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Depends on your data model.

     

    If you have a table of Products with Average Invoice Charge and another table with your Invoices, then you could link the two tables on something like Product ID and then add a calculated column or measure like:

     

    AboveAverage = CALCULATE(COUNTROWS(RELATEDTABLE(Invoices)),Invoices[InvoiceCharge]>Products[AverageInvoiceCharge]),

    Something like that.