Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
DM0010
Regular Visitor

Multiple IF functions

Hello everyone,

 

I have a question wrt multiple IF functions in DAX.

The situation is as follows: I have a general ledger table with all the account numbers of a company. Every row in the table represents one transaction that is connected with an amount. This amount is always positive, whether it has a positive or negative impact on a certain account number. There is a colomn which determines the impact (positive or negative), which is the the CODEDC colomn. Here there are two possibilities: D = debit or C = credit.

 

As you may know, in accounting there are certain rules

Assets: Debit amounts are positive when you add them up, credit amounts are negative

Debt/Equity: Credit amounts are positive when you add them up, debit amounts are negative

Costs: Debit amounts are positive when you add them up, credit amounts are negative

Income: Credit amounts are positive when you add them up, debit amounts are negative

 

Now I want to add a column that show the real amounts (ea amounts with the right effect on a certain account). So if this is a cost account (let's say OPEX), when this is a debit amount, the amount should be positive, vice versa.

 

DM0010_0-1669815111985.png

Here is an example of a part of the table that is present (where REKENING is the specific account number, BEDRAG = the amount and CODEDC = debit or credit).

 

My first guess would be that I will use a multiple IF function in the formula. Is this correct or is there another more efficient way?

 

Many thanks in advance for helping me out.

 

Kind regards,

 

DM0010

1 REPLY 1
henkvankester
Helper I
Helper I

Maybe you should create a new measure like:

 

NameMeasure= IF(CODEDC = D, [Bedrag] *-1,

                           IF(CODEDC = C, [Bedrag], BLANK()))

 

When you create a table with REKENING and the measure you should be able to see the real amounts.

 

Everything without a C or D in column CODEDC will not be taken into account. 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors