Forum Discussion
Calculate balance
Hi,
I have a dataset where each row is a transaction.
The amount moved from one location to another location.
How do I calculate the balance for each location?
For example, Location A has 775 outgoing and 275 incomings.
And the difference is incoming - outgoing, so in this case -500.
The visual in Power Bi is a card for each from location and then the balance.
Can somebody help me?
Hello Anonymous,
You can just use the sum for the relationship that is active and CALCULATE() along with USERELATIONSHIP() for the inactive relationship.
I have attached my PBIX for your reference.
Hope this helps.Thank you,
Vishesh Jain
3 Replies
- amitchandak
Super User
Anonymous , Create a table with location and join with both column, On join will be inactive, make that active using userelationship in measure
refer
- AnonymousNot applicable
Thank you for the answer!
How would you make the actual measurements when you have made the table and the relationship?
- visheshjain
Impactful Individual
Hello Anonymous,
You can just use the sum for the relationship that is active and CALCULATE() along with USERELATIONSHIP() for the inactive relationship.
I have attached my PBIX for your reference.
Hope this helps.Thank you,
Vishesh Jain