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
Category | Sales 2018 | Sales 2019 |
A | 199 | 169 |
B | 154 | 138 |
C | 161 | 186 |
D | 191 | 193 |
E | 175 | 189 |
F | 142 | 171 |
G | 181 | 160 |
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
Where is this inbuilt function in PowerBI?
There is inbuilt function but there are scenarios where inbuilt function doesn’t work as required then DAX is used.
HI, is there a way to get the difference in % between 2018 an 2019 in the colum and in the total ?
Hi Chris,
You can get the difference by taking measure difference for 2018 and 2019.
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)
How can it use the built-in column of percentages in other calculations?