Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Problem with Count

Hi Everyone,

I am new to Power BI and I have a count problem. In the table below, I am trying to create an analysis of how the delivery days of the following products have changed from Jan - May. The below table shows the product and delivery days in each month. Product A for example was delivered within 90 days in Jan, Feb and Mar, and delivered within 60 days in April and May. Product B however was only delivered within 60 days during the entire period, thereofre it has only one delivery days, e.t.c.

1) How can I count the products with different delivery days (i.e Products A, C and D)?

2) Can you advise on the best visual to represent the Products and their Delivers Days by Month?

 

PS: The 1s under the months are only representative of the delivery days and not a count of product.

 

Thank you for your anticipated assistance

 

ProductDelivery DaysJanFebMarAprilMay
A90111  
A60   11
B6011111
C601    
C45 1 1 
C90  1 1
D45  111
D6011   
E6011111

 

10 Replies

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

    Is this how your data are structured (with Months as columns)?  If so, the data should be unpivoted in the query editor.  Once that is done, a measure can be written that give the count of products that have >1 values of Delivery Days.

     

    Regards,

    Pat

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Pat,

      Thanks for the message. The data is not structured as months in column. I only included it in the table to show how the delivery days changes during the month.  If we are to ignore the months column, how can I count the products that have > 1 values of delivery days. Thank you.

  • FrankAT's avatar
    FrankAT
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

    1.  Unpivot month columns in Power Query (see figure).
    2. Use a table visual and the following measure:
    Count Delivery Days = SUMX('Table','Table'[Delivery Days] * 'Table'[Value])

     With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
    FrankAT (Proud to be a Datanaut)

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi FrankAT,

       

      Thanks for the message. However, I am not trying to count the delivery days. I want to count the product that have more than one delivery days value. For instance, Product A has 2 values in delivery days (i.e. 60 and 90), while Product B has only 1 value in delivery days (i.e. 60).

       

      FrankAT 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Update: We can ignore the months columns as I can see that it is causing some comfusion.

        mahoneypat FrankAT