Forum Discussion

mypants's avatar
mypants
Regular Visitor
8 years ago
Solved

Need Help on total percent

Hey All, 

 

I need help on creating a percentage by date, as you know grand total does a percentage based on all data elements.

 

I tried the following: https://community.powerbi.com/t5/Desktop/Percentage-of-total-by-Product/td-p/154838

 

I have tried:

Test = SUM('RPT DeliveryProjection'[TotalDeliveries]) / CALCULATE(SUM('RPT DeliveryProjection'[TotalDeliveries]),FILTER('RPT DeliveryProjection',ALLEXCEPT(['RPT DeliveryProjection'[WeekStarting])))

 

But, I keep getting the error:
Too few arguments were passed to the ALLEXCEPT function. The minimum argument count for the function is 2.

 

Image below - What I need is the percentage column by day (not all time)... (Excuse the datetime, I opened the data in excel and it created the timestamp, it is a date in PBI) 

 

 

 

Thanks in advance, let me know if you require anymore context?

  • Hi,

     

    Try this

     

    =SUM('RPT DeliveryProjection'[TotalDeliveries]) / CALCULATE(SUM('RPT DeliveryProjection'[TotalDeliveries]),ALLEXCEPT('RPT DeliveryProjection','RPT DeliveryProjection'[WeekStarting]))

5 Replies

  • Hi,

     

    The ALLEXCEPT function takes the first input as a Table.  So the ALLEXCEPT portion should be:

     

    ALLEXCEPT('RPT DeliveryProjection',['RPT DeliveryProjection'[WeekStarting])

    • mypants's avatar
      mypants
      Regular Visitor

      Hey thanks, that raises the second error I get:

       

      "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."

       

      The whole query:

       

      Test = SUM('RPT DeliveryProjection'[TotalDeliveries]) / CALCULATE(SUM('RPT DeliveryProjection'[TotalDeliveries]),FILTER('RPT DeliveryProjection',ALLEXCEPT('RPT DeliveryProjection','RPT DeliveryProjection'[WeekStarting])))

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        Hi,

         

        Try this

         

        =SUM('RPT DeliveryProjection'[TotalDeliveries]) / CALCULATE(SUM('RPT DeliveryProjection'[TotalDeliveries]),ALLEXCEPT('RPT DeliveryProjection','RPT DeliveryProjection'[WeekStarting]))