Forum Discussion
How to calculate dynamic percentage difference from the same column
Hello all,
I am trying to calculate dynamically the percent difference using Price values from the same column and using filter context from two different columns (Month and Type)
I have been trying this measures formula below but I am sure my DAX is off.
| Month | Type | Price |
| Mar | Income | $1000 |
| Mar | Expense | $500 |
| April | Income | $300 |
| April | Expense | $800 |
7 Replies
- DataNinja777
Super User
My observation is that for your Expense Calc measure, you do not need to input hard corded "April" month, and similarly for your Income Calc, you do not need the hard coded "April" month filtering.
Your [percent diff] measure is just the margin and I wouldn't call it as percent diff as it is not describing what it is.
- trying2learnpbiNew Member
DataNinja777 thanks for the reply. I tried removing April but am getting error message (see screenshot below). Any help would be appreciated.
- DataNinja777
Super User
Dax is like an excel formula. You can delete the blue crossed out part.
Best regards,
- Ajithkumar_03Frequent Visitor
Hi trying2learnpbi ,
I hope this below Measures will help you,
Measure 1:Measure 2:
Measure 3:
Dynamically it will work.
Best Regards,
Ajith Kumar
If it solves your issue, please accept it as the solution to help the other members find it more quickly.- trying2learnpbiNew Member
Ajithkumar_03 thanks for your reply. I tried your format but am getting the error below. It is weird since the Type column has two values (income and expense).
- Ajithkumar_03Frequent Visitor
- AnonymousNot applicable
Hi trying2learnpbi ,
Is your problem solved? If it is solved, you can mark the correct answer as a marker, if it is not solved, you can provide detailed information we can help you better.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.