Friday, September 21, 2018

Power BI - Calculate Percentage % of Total Value

Create a Measure, Use this formula
DataSet Table is Combined_HistoricalSales.
Get the Sum of TotalAmount for the ProductClass. Store it in var bigTotal, then divide by Sum of TotalAmount. Multiply the result by 100.

-------------------------------
MeasureName = var bigTotal = SUMX(ALL(Combined_HistoricalSales[ProductClass]), CALCULATE(SUM(Combined_HistoricalSales[TotalAmount])))
                    return DIVIDE(SUM(Combined_HistoricalSales[TotalAmount]),bigTotal)*100


------------------------------
To get percentage totals of items within a class
------------------------------
% of Class Sales = var bigTotal = SUMX(ALL(Combined_HistoricalSales[StockCodeDesc]), CALCULATE(SUM(Combined_HistoricalSales[TotalAmount])))
                    return DIVIDE(SUMX(ALL(Combined_HistoricalSales[ProductClass]), CALCULATE(SUM(Combined_HistoricalSales[TotalAmount]))),bigTotal)*100

No comments:

Post a Comment