Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
10 years ago
Solved

Percent of Total

I cannot find the DAX formula that will give me the % of Total results.  I added a calculated field (%) to the below power BI table.  In that column I am trying to get it to display the results as sh...
  • greggyb's avatar
    greggyb
    10 years ago

    Greg_Deckler, I think you meant to use CALCULATE() or switched the order there.

     

    TotalQuantity =
    SUM( 'Table'[Quantity] )
    
    % Total =
    [TotalQuantity]
        / CALCULATE(
            [TotalQuantity]
            ,ALL( 'Table' )
        )
    
    
    ***OR***
    
    TotalQuantity =
    SUM( 'Table'[Quantity] )
    
    % Total =
    [TotalQuantity]
        / SUMX(
            ALL( 'Table' )
            ,'Table'[Quantity]
        )

    Either construction would work, but I'd lean toward the former idiom.