Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I'm trying to work out how to calculate percentages from a simple table in powerbi desktop.
I click on "Table" under visualizations and create a table.
Then I drag and drop a measure called 'Sales' into the table,
then drag and drop in a then drop in Sales_Confirmed dimension,
then drag and drop in Month dimension into the table.
This is what it looks like after the table is built:
Month Sales Sales_Confirmed
1 100,000 true
2 200,000 true
3 500,000 true
Total 800,000
What I am trying to do is work out how to create a new column in the table that is the percentage of total for month 1,2 & 3.
So month 1 percentage would be 100000/800000 * 100 = 12.5% and so on.
Then I need some way to calculate & add the percentage column values in the table itself as so I can graph them?
Where I get stuck is working out how to get 800,000 total value to use for a calculated column.
I dont want to hard code in 800,000 as the page also has a slicer that can vary the year.
Can someone assist please?
Solved! Go to Solution.
You can use ALL() function in dax
create a measure to calculate total sales irrespective of filter use
Total_sales=calculate(sum(sales),ALL('table_name'))
now for the percentage u can do the following
sales%=sum(sales)/Total_sales
if this helps please masrk as solution
Hello @wokka,
As per your requirement you're creating a calculated column and you need the total value i.e 800000
so Below is the DAX for calculated column which returns the total value;
You can use ALL() function in dax
create a measure to calculate total sales irrespective of filter use
Total_sales=calculate(sum(sales),ALL('table_name'))
now for the percentage u can do the following
sales%=sum(sales)/Total_sales
if this helps please masrk as solution
User | Count |
---|---|
77 | |
75 | |
46 | |
31 | |
28 |
User | Count |
---|---|
99 | |
91 | |
51 | |
49 | |
46 |