Looking to calculate the percent of total in Power BI using DAX

Hey guys,

I want to create a measure for percentage of total. I have this table for import and export:
sample
How can I add a measure here for “Import % of Total” for each row and total?

Cheers,
Andrea

Hi,

You will need to dive into the courses and material for the understanding of context and CALCULATE.
Quick answer, assuming you have a Total column in the data as you show:
Create measures;

measure 1
Total Sales = SUM(Total)

measure 2
% of Sales - Customer =
DIVIDE ( [Total Sales] ;
CALCULATE ( [Total Sales] ;
ALL ( Customers )
);
0)

As you will notice CALCULATE changes the context, ALL removes all filters from the Customers table, so in this case it will divide each customer’s sales by 483.

Paul

Enterprise%20DNA%20Expert%20-%20Small