Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have a table in PowerBI desktop and i have total 5 columns as below :
Region | Month | INV | Cost | %Total |
AFR | 1 | 477 | 4000 | 98% |
APC | 2 | 6763 | 2000 | 97% |
Grand Total | 11533 | 6000 |
I have added a custom column (total):
Custom Column Formula : Divide(INV/Cost)
So here, I can get the Grant total of INV and Cost but am not able to get the Grand total percentage( Percentage should be like 100%only)
Grant Total formula : INV/Cost
Can you please someone help me with this.
Thanks in advance
Solved! Go to Solution.
That's simple math for DAX, but it's not really a "% of Total" is it?
The DAX Measure you want is exactly as you describe:
My Measure = DIVIDE ( SUM ( [Cost] ) , SUM ( [INV] ), 0 )
Proud to be a Super User! | |
Actually my requirement is :
%total = Grand total of Cost(6000)/Grand total of INV(1000)*100
These details should be reflected to total label under %total.Below is the table for your reference.
Region | Month | INV | Cost | %total |
AFR | 3 | 450 | 2500 | 2500/450(cost/inv) |
ASA | 4 | 550 | 3500 | 3500/550(cost/inv) |
Grand Total | 1000 | 6000 | 6000/1000(Grand total cost/grand total inv) |
Thanks
That's simple math for DAX, but it's not really a "% of Total" is it?
The DAX Measure you want is exactly as you describe:
My Measure = DIVIDE ( SUM ( [Cost] ) , SUM ( [INV] ), 0 )
Proud to be a Super User! | |
Hi, @Rup10
Based on description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create a custom column with the following m codes.
[INV]/[Cost]
Then you need to set the aggregation of 'Custom' as 'Sum'
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Not sure I understand the math here. For the first row, 477 divided by 4000 is NOT 98%.
You should make your calculation be a MEASURE instead of a COLUMN. A Measure can operate on the whole table.
My Measure = DIVIDE ( SUM(INV), SUM(Cost), 0)
Proud to be a Super User! | |
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |