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
alhyde
New Member

IF Statement in DAX Help

I have data in column A that I want to filter into two columns - column B and column C.  Column A contains both negative and positive numbers.  I want postive numbers in column B and negative numbers in column C.  In Excel, this would be a simple IF statment, but I am unsure how to write this in DAX.  Help, please!

1 ACCEPTED SOLUTION
CheenuSing
Community Champion
Community Champion

@alhyde

 

1. ColumnB= If ( YourTable[ColumnA] >= 0 , YourTable[ColumnA])

 

2. ColumnC= if ( If ( YourTable[ColumnA] < 0 , YourTable[ColumnA])

 

If this works for you please accept this as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

View solution in original post

7 REPLIES 7
RobJo
Helper I
Helper I

@CheenuSing

 

Hi, 

 

Thanks for your support. 

 

I don't know how to post sample files on this forum. 
Here is my e-mail adres: rob_jouvenaar@hotmail.com

Please send me a email and i will reply you the sample files.  OK?

 

Rob Jouvenaar

 

CheenuSing
Community Champion
Community Champion

Hi @RobJo

 

I have sent a mail to your hotmail account. Please check and respond.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
RobJo
Helper I
Helper I

@CheenuSing

 

Hello,

 

I had the same question and managed to split the values of column A (amount) over column B (debet) and column C (credit).
Column A is a measure: SUM(table[Amount]). 
The issue i have is in the totals. 
I would like to summerize all (postive) amounts of column B and the (negative) amounts of column C, 

With this solution above i get totals with 0 and i don't understand that. 

Can you please help me with this?

Rob 

CheenuSing
Community Champion
Community Champion

Hi @RobJo

 

Please post sample data and the expressions used.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
blopez11
Resident Rockstar
Resident Rockstar

Try doing it in the query editor

You can either create two new columns (B and C), one with the positive values, and one with the negative values

Or create one with the negative values, then filter out the negative values from column A

CheenuSing
Community Champion
Community Champion

@alhyde

 

1. ColumnB= If ( YourTable[ColumnA] >= 0 , YourTable[ColumnA])

 

2. ColumnC= if ( If ( YourTable[ColumnA] < 0 , YourTable[ColumnA])

 

If this works for you please accept this as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

Thank you for your help, @CheenuSing!!

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.