Forum Discussion
% Dax formular
Hi,
I am trying to work out what one number is as a percentage of another number.
For example, what is the totals of 1 column as a percentage of another column?
Column A totals up to 10
Column B totals up to 100
I ideally want to work out what percentage is column A out of column B so the answer will be 10 but how do I transfer this to Power Bi?
- Anonymous6 years ago
Hi Anonymous ,
You can create a measure using DIVIDE function to get it and set the data type as "Percent".
In addition, you can refer the following documentations to know syntax and usage of every DAX function.
https://docs.microsoft.com/en-us/dax/dax-overview
Best Regards
Rena
4 Replies
- Greg_DecklerCommunity Champion
Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.But maybe: Measure = SUM('Table'[ColumnA]) / SUM('Table'[ColumnB])
- amitchandakSuper User
Anonymous , no very clear
measure = divide(sum(Table[A]),sum(Table[B]))
- speedrampsSuper User
Hi Serdet
If you are new to Power BI then try start by using the Quick Measures.
Simply clickon Modeling on the top menu and then click Quick Measure.
the wizard is straight forward to follow and you will find Percent Difference under Mathmatical Operations.
It is good way to learn DAX.
Or try this ....
Branch
Product
Quantity
Spain
Apples
3
Spain
Oranges
6
Italy
Apples
8
England
Apples
14
England
Pears
5
Germany
Bananas
18
Germany
Oranges
6
Create dax measures:-
Total quantity = SUM(Sales[Quantity])
Total apples = CALCULATE([Total quantity],Sales[Product]="Apples")
Apple percentage = DIVIDE([Total apples],[Total quantity],0)
Set Apple percentage format type to %
Add a table visual with
Branch, Total quantity, Total apples, Apple percentage
Hope that helps!
- AnonymousNot applicable
Hi Anonymous ,
You can create a measure using DIVIDE function to get it and set the data type as "Percent".
In addition, you can refer the following documentations to know syntax and usage of every DAX function.
https://docs.microsoft.com/en-us/dax/dax-overview
Best Regards
Rena