Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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