Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Count how often a same order number appears.

Hi people, I hope somebody can help. I think the soulution could be pretty easy, but I couldn't figure it out yet:

 

I have a column with different and same order numbers. I want to count how often a order numbers appears just one time and how often an order numbers appears multiple times. And then show it in a diagram.

 

In Excel I would just create a pivot table which count the quantity of how many times a number appears and then I could show the actual number with an "COUNTIF" function.

How could I do it in a efficient way in PowerBi?

 

Thanks in advance! 🙂

  • You could try these two expressions

     

    Orders One Time =
    COUNTROWS (
        FILTER (
            DISTINCT ( Table[OrderNumber] ),
            CALCULATE ( COUNTROWS ( Table ) ) = 1
        )
    )
    
    Orders Multiple Times =
    COUNTROWS (
        FILTER (
            DISTINCT ( Table[OrderNumber] ),
            CALCULATE ( COUNTROWS ( Table ) ) > 1
        )
    )

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat



2 Replies

  • mahoneypat's avatar
    mahoneypat
    Icon for Microsoft Employee rankMicrosoft Employee

    You could try these two expressions

     

    Orders One Time =
    COUNTROWS (
        FILTER (
            DISTINCT ( Table[OrderNumber] ),
            CALCULATE ( COUNTROWS ( Table ) ) = 1
        )
    )
    
    Orders Multiple Times =
    COUNTROWS (
        FILTER (
            DISTINCT ( Table[OrderNumber] ),
            CALCULATE ( COUNTROWS ( Table ) ) > 1
        )
    )

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat



    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you very much, that worked out perfectly!  😊