Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I am relatively new in power BI and not sure how to get the following results in power bi. Can someone help
Solved! Go to Solution.
@AdilDawood
Go to Modeling Tab, click on New Table create a new table with the following code. This will list all the accounts from Both FROM and TO columns.
All Acounts =
SELECTCOLUMNS(
DISTINCT(
UNION( VALUES(Accounts[From Account]), VALUES(Accounts[To Account]))
),
"Account", Accounts[From Account]
)
Insert a Table B Visual and bring the Account field from the new table. Add the following measure.
Balance of Accounts =
var _Acc = SELECTEDVALUE('All Acounts'[Account]) return
CALCULATE( SUM(Accounts[Amount]) , Accounts[To Account] = _Acc ) -
CALCULATE( SUM(Accounts[Amount]) , Accounts[From Account] = _Acc )
Result
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi,
You may download my PBI file from here.
Hope this helps.
Thanks Ashish
Although your solution does work for this data but this is a sample data and actual data is quite large. The solution provided by @Fowmy works better on that.
Thanks anyway for the resposne.
@AdilDawood
Go to Modeling Tab, click on New Table create a new table with the following code. This will list all the accounts from Both FROM and TO columns.
All Acounts =
SELECTCOLUMNS(
DISTINCT(
UNION( VALUES(Accounts[From Account]), VALUES(Accounts[To Account]))
),
"Account", Accounts[From Account]
)
Insert a Table B Visual and bring the Account field from the new table. Add the following measure.
Balance of Accounts =
var _Acc = SELECTEDVALUE('All Acounts'[Account]) return
CALCULATE( SUM(Accounts[Amount]) , Accounts[To Account] = _Acc ) -
CALCULATE( SUM(Accounts[Amount]) , Accounts[From Account] = _Acc )
Result
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!