Percentage (%) of Total using DAX in PowerBI

Hello friends! Today we’ll be learning to calculate percentage of total using DAX in Power BI.

There is inbuilt function in Power BI but sometimes it is required to calculate the percentage of total using DAX.

Data

Data is following format

CategorySales 2018Sales 2019
A199169
B154138
C161186
D191193
E175189
F142171
G181160

DAX query

% of total 2018 using DAX = SUM(Sales[Sales 2018])/CALCULATE(SUM(Sales[Sales 2018]),ALL(Sales))
% of total 2019 usign DAX = SUM(Sales[Sales 2019])/CALCULATE(SUM(Sales[Sales 2019]),ALL(Sales))

Final Table

Keep visiting Analytics Tuts for more tutorials.

Thanks for reading! Comment your suggestions and queries


7 comments

  • Where is this inbuilt function in PowerBI?

  • HI, is there a way to get the difference in % between 2018 an 2019 in the colum and in the total ?

  • I have a table

    City population
    A. 10000
    B. 20000
    C. 30000
    D. 40000

    I want calculate % of population to to each city using dax, what dax will use for the above.

    • Total Population=SUM(population)
      Total Population fixed=Calculate([Total Population],all(table))
      % Total Population=divide([Total Population],[Total Population fixed],0)

    • ——————————————

      Total Population=SUM(population)
      ——————————————
      Total Population fixed=Calculate([Total Population],all(table))
      ——————————————
      % Total Population=divide([Total Population],[Total Population fixed],0)

Leave a Reply

Your email address will not be published. Required fields are marked *