Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hello,
I have a pretty simple table in Power BI. It shows the actual expenses in one column and the budget for that year in the other column. I am trying to create a third column which shows the percentgae difference, if the expense are under the budget, by how much %, or if over, by how much. Any help, how I can create that measure. Thanks
Solved! Go to Solution.
Hi @pfarahani ,
According to your description, whether it is column or measure, a field type can only be the same. Therefore, even if the judgment condition is used, the result of percentage and numeric value cannot be displayed in the same column.
Two different results can only be obtained in the following ways, refer to the following:
Measure =
var a = CALCULATE(SUM('Table'[Actual Expense]),ALLEXCEPT('Table','Table'[Fiscal Year]))
var b = CALCULATE(SUM('Table'[Budget Expense]),ALLEXCEPT('Table','Table'[Fiscal Year]))
return
IF(b>a,(b-a)/b,0)
Measure =
var a = CALCULATE(SUM('Table'[Actual Expense]),ALLEXCEPT('Table','Table'[Fiscal Year]))
var b = CALCULATE(SUM('Table'[Budget Expense]),ALLEXCEPT('Table','Table'[Fiscal Year]))
return
IF(b>a,0,-(b-a))
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @pfarahani ,
According to your description, whether it is column or measure, a field type can only be the same. Therefore, even if the judgment condition is used, the result of percentage and numeric value cannot be displayed in the same column.
Two different results can only be obtained in the following ways, refer to the following:
Measure =
var a = CALCULATE(SUM('Table'[Actual Expense]),ALLEXCEPT('Table','Table'[Fiscal Year]))
var b = CALCULATE(SUM('Table'[Budget Expense]),ALLEXCEPT('Table','Table'[Fiscal Year]))
return
IF(b>a,(b-a)/b,0)
Measure =
var a = CALCULATE(SUM('Table'[Actual Expense]),ALLEXCEPT('Table','Table'[Fiscal Year]))
var b = CALCULATE(SUM('Table'[Budget Expense]),ALLEXCEPT('Table','Table'[Fiscal Year]))
return
IF(b>a,0,-(b-a))
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@pfarahani Is [Actual Expenses] a column or measure?
If it's a measure, create a new measure:
% Diff = DIVIDE([Actual Expenses] - [Budget Expenses], [Budget Expenses])
If it's a column, create new measures:
Total Actual Expenses = SUM(Table[Actual Expenses])
Total Budget Expenses = SUM(Table[Budget Expenses])
and use the measures in the % Diff measure.
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
User | Count |
---|---|
84 | |
71 | |
71 | |
67 | |
55 |
User | Count |
---|---|
94 | |
92 | |
91 | |
77 | |
70 |