cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
awaheedm-
New Member

How to Combine Debit and Credit Ledger Account Data into a Single Line in Microsoft Power Query

Hello Microsoft Community,

I'm currently working with data in Excel and I'm facing a challenge that I hope someone can assist me with.

 

I have a dataset that displays debit and credit entries on separate lines like this:

 

Date       | Account     | Debit ($) | Credit ($)

------------------------------------------------

2023-10-01 | Account A   | 100       | 0

2023-10-01 | Account B   | 0         | 100

2023-10-02 | Account A   | 50        | 0

2023-10-02 | Account B   | 0         | 30

2023-10-02 | Account C   | 0         | 20

 

However, I need to combine the debit and credit entries for each account into a single line to get a ledger-like format, like this:

 

Date       | Debit Account | Credit Account | Amount ($)

------------------------------------------------

2023-10-01 | Account A   | Account B   | 100

2023-10-02 | Account A   | Account B   | 30

2023-10-02 | Account A   | Account C   | 20

Is there a way to achieve this in Excel? Any guidance or suggestions on how to approach this problem would be greatly appreciated.

 

Thank you in advance for your help!

 

2 REPLIES 2
mussaenda
Community Champion
Community Champion

Hi @awaheedm- ,

 

mussaenda_0-1696430619275.png

 

AlienSx
Super User
Super User

Hello, @awaheedm- do you always have the same pattern when only one debit and one or more credit entries back to back in line for the same date? Or the following:

Account A DT 60

Account B DT 40

Account C CR 70

Account D CR 30

is also possible for the same date?

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors