Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Dear members
Actually I want to perform very simple task.
I have 'Account number' and 'Amount' column in my table. I would like to create new column with if condition
In Excel, it looks like If(left('Account Number',1)=1, 'Amount', if(left('Account Number',1)=2, 'Amount'*(-1),0)
If the first digit of account number is 1 then took the original amount, if the first digit of account number is 2 then took the reverse.
I couldn't formulate this condition. Please help me.
Solved! Go to Solution.
@OSS Please try this..
NewAmount = IF(LEFT(Test181[Account],1)="1",Test181[Amount],IF(LEFT(Test181[Account])="2",Test181[Amount]*-1,0))
Proud to be a PBI Community Champion
hi,
shouldnt it be like this:
NewAmount = IF(LEFT(Test181[Account],1)="1",Test181[Amount],IF(LEFT(Test181[Account],1)="2",Test181[Amount]*-1,0))
@OSS Please try this..
NewAmount = IF(LEFT(Test181[Account],1)="1",Test181[Amount],IF(LEFT(Test181[Account])="2",Test181[Amount]*-1,0))
Proud to be a PBI Community Champion
hi,
shouldnt it be like this:
NewAmount = IF(LEFT(Test181[Account],1)="1",Test181[Amount],IF(LEFT(Test181[Account],1)="2",Test181[Amount]*-1,0))
@Anonymous @OSS
Thanks for that !! But anyway, the second parameter for LEFT function is optional. By default it will take 1 if we don't specify.
Proud to be a PBI Community Champion
cheers ok, i didn't know that
thanks
Thank you for warning, Theo. 1 is forgotten in the formula. Thank you for correction. It would help to avoid confuse if anyone would like to use this formula.
Thank you very much Pattem. I wrote the same formula but forgot ""
That is why my formula wasn't accepted 🙂
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 69 | |
| 67 | |
| 32 | |
| 27 | |
| 26 |