Forum Discussion

vincenttys's avatar
vincenttys
Helper I
1 year ago
Solved

Calculate Percentage

Hi all,

I am trying to achieve the outcome shown in the table below using Power BI. However, I'm having trouble calculating the % of delivered, which should be the sum of Delivered divided by the number of weeks.

The Panel column represents what is currently displayed in my Matrix table.

 

          Panel
Vendor 19/04/202526/04/202503/05/202510/05/202517/05/202524/05/202531/05/2025% of delivered Rows
A100011157.1% Vendor
B000001128.6%  
C111000042.9% Columns
D1111111100.0% WeekEnd
           
          Values
          Measure - Delivered

 

Any guidance would be appreciated!

 

Regards,

Vince

  • Hi all,

    Apologies for the delayed reply—I've been flat out with work.

    Thank you again for looking into my question. While I appreciate the suggested solutions, they didn’t quite meet my requirements. I ended up creating another visual to show the overall YTD percentage.

    Thanks again for your support.

    Best regards,
    Vince

15 Replies

  • Hi vincenttys,

    Wanted to let you know that you can use below measure to achive your requirement.

    % Delivered = 
    VAR TotalWeeks = CALCULATE( DISTINCTCOUNT('YourTable'[Date]),
                                REMOVEFILTERS('YourTable'[Vendor])  -- count across all vendors
                               )
    VAR DeliveredCount = SUM('YourTable'[Delivered])
    RETURN
    DIVIDE(DeliveredCount, TotalWeeks)

    Matrix Chart Field Details

     

    • Rows: Vendor

    • Columns: WeekEnd Date

    • Values:

      • Delivered (as is)

      • % Delivered (the above DAX measure)

     

     

    Thanks,
    If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.

    • vincenttys's avatar
      vincenttys
      Helper I

      Hi ajaybabuinturi 

      Thanks for getting back to me so quickly.

      I’d like to display only the % Delivered as a single column. Currently, I’m showing Week 1 with both Delivered and % Delivered, followed by Week 2 with the same format, and so on.

      I hope that makes sense—please let me know if you need clarification.

      Thank you

       

      • v-menakakota's avatar
        v-menakakota
        Community Support

        Hi  vincenttys ,
        Thanks for reaching out to the Microsoft fabric community forum. 

        Use the following measure:

        % Delivered = 
        VAR DeliveredCount = SUM('YourTable'[Delivered])
        VAR TotalWeeks = CALCULATE(DISTINCTCOUNT('YourTable'[WeekEnd]), REMOVEFILTERS('YourTable'[Vendor]))
        VAR Result = DIVIDE(DeliveredCount, TotalWeeks)
        RETURN
        IF(
           ISINSCOPE('YourTable'[Vendor]), 
           Result, 
           BLANK()
        )

        Take a Matrix visual and add following fields:

        • Rows: Vendor
        • Values: % Delivered (Only this measure)
        • Go to the Fields pane on the right side. 
        • Click on the %Delivered measure. Set the Data Type to Decimal Number (if it's not already), and then set Format to Percentage with 1 decimal place, for example.

          Please go through the screenshot and document for more information:

           

          If I misunderstand your needs or you still have problems on it, please feel free to let us know.   
          If this post was helpful, please give us Kudos and consider marking Accept as solution to assist other members in finding it more easily.
  • Hello vincenttys 

     

    try this measure

    % Delivered =

    VAR DeliveredCount = SUM('YourTable'[Delivered])

    VAR WeekCount = CALCULATE(

        DISTINCTCOUNT('YourTable'[WeekEnd]),

        ALLSELECTED('YourTable'[WeekEnd])

    )

    RETURN

    DIVIDE(DeliveredCount, WeekCount)

     

    Thanks,
     Pankaj Namekar | LinkedIn

    If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

    • vincenttys's avatar
      vincenttys
      Helper I

      Hi pankajnamekar25 

      Thanks for getting back to me so quickly.

      I’d like to display only the % Delivered as a single column. Currently, I’m showing Week 1 with both Delivered and % Delivered, followed by Week 2 with the same format, and so on.

      I hope that makes sense—please let me know if you need clarification.

      Thank you

      Regards

      Vince

  • RicoZhou's avatar
    RicoZhou
    Frequent Visitor

    Hi vincenttys ,

     

    I think you can show % of delivery in subtotal position.

    You can try measure as below.

    Measure = 
    VAR _Count = CALCULATE(COUNT('Table'[Weekend]),FILTER('Table','Table'[Value] = 1))+0
    VAR _Total = CALCULATE(COUNT('Table'[Weekend]))
    RETURN
    IF( HASONEVALUE('Table'[Weekend]),_Count, FORMAT(DIVIDE(_Count,_Total),"0.0%"))

    Result is as below.

     

    Best Regards,

    Rico Zhou

     

    • vincenttys's avatar
      vincenttys
      Helper I

      Hi RicoZhou ,

      Are you able to give me more guidance as i am pretty new to this?

      Currently, i have huge table that contain the data which have week ending for each records and whether it is delivered - that column will show 1 if delivered and 0 otherwise.

      Example Week 1, i have 3 vendors A, B and C and in Week 1

      Vendor A have 3 delivered, Vendor B have 0 delivered and Vendor C have 2 delivered.

      My measure will have "delivered count" which is the average as i just want to show 1 and 0 for the week for either delivered or not.

      The next step is i will have a matrix table with vendor in rows and week ending for current FY in columns as my original post stated.

      Now i want to add % delivered for current FY. 

      I think your idea of showing % of delivery in subtotal position is what i want but i am not sure how to get there.

      Thanks again for helping.

      Regards,

      Vince

       

       

       

  • Hi all,

    Apologies for the delayed reply—I've been flat out with work.

    Thank you again for looking into my question. While I appreciate the suggested solutions, they didn’t quite meet my requirements. I ended up creating another visual to show the overall YTD percentage.

    Thanks again for your support.

    Best regards,
    Vince

    • v-menakakota's avatar
      v-menakakota
      Community Support

      Hi vincenttys ,

      We really appreciate your efforts and for letting us know the update on the issue.

      Please continue using fabric community forum for your further assistance.

      If this is the solution that has worked for you please accept your reply as solution so as to help other community members who may face similar issue in the future.
      Best Regards, 
      Menaka.
      Community Support Team

       

    • v-menakakota's avatar
      v-menakakota
      Community Support

      Hi vincenttys ,

      We really appreciate your efforts and for letting us know the update on the issue.

      Please continue using fabric community forum for your further assistance.

      If this is the solution that has worked for you please accept your reply as solution so as to help other community members who may face similar issue in the future.
      Best Regards, 
      Menaka.
      Community Support Team