Forum Discussion

IamTDR's avatar
IamTDR
Responsive Resident
7 years ago
Solved

Dax Measure for Counting Order Numbers with Multiple Invoice Numbers

Is there a way to calculate within a table the number of invoices associated with a order number?

  • I needed to keep the Order Number column in my visual.

     

    I just completed getting my visual to work as designed by using power query.

    I made a duplicate of my table, left just the order_number and invoice_number columns. Did a grouping on order_number distinct count on invoice_number.  Merged these results to my oringial table.  Then finally added the newly created field into my visual and deselected 'sum'.

     

    Thanks for the aid.  I'm sure a better way could be done.

4 Replies

  • IamTDR yes it should be easy assuming each invoice has order number, you can drop order number and invoice in table visual and change aggreation method of invoice number to count by clicking the arrow button next to it.

  • IamTDR's avatar
    IamTDR
    Responsive Resident

    Thanks for the quick reply.

    Below is my table visual.  As you can see, I have the same order number and two invoice numbers.  I would like the field 'Count of invoice_number - copy' to read 2, as I have one order number with two invoices.

    Tim

     

     

    • parry2k's avatar
      parry2k
      Super User

      IamTDR create a measure

       

      on table visual, drop order number column and following measure, and you will get count.

       

      # of Invoices = COUNT( Table[Invoice Number] )
      • IamTDR's avatar
        IamTDR
        Responsive Resident

        I needed to keep the Order Number column in my visual.

         

        I just completed getting my visual to work as designed by using power query.

        I made a duplicate of my table, left just the order_number and invoice_number columns. Did a grouping on order_number distinct count on invoice_number.  Merged these results to my oringial table.  Then finally added the newly created field into my visual and deselected 'sum'.

         

        Thanks for the aid.  I'm sure a better way could be done.