March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have a basic table with a sales Id, Amount, Type activity. I want to create a new column in the table which will just return the Payments. So type = Payment, otherwise it will return a 0 for the other types. It should be based on id and the result set should look like below.
Id | Amount | Type | Payment AMount | |||||||
1 | 2 | Payment | 2 | |||||||
1 | 3 | Refun | 0 | |||||||
1 | 6 | Payment | 6 | |||||||
2 | 4 | Payment | 4 | |||||||
2 | 4 | Refund | 0 | |||||||
2 | 6 | Refund | 0 | |||||||
3 | 6 | Something | 0 | |||||||
3 | 4 | Refund | 0 | |||||||
3 | 1 | Payment | 1 | |||||||
4 | 1 | Payment | 1 | |||||||
4 | 2 | Something | 0 | |||||||
4 | 5 | Something | 0 | |||||||
4 | 10 | Payment | 10 |
Solved! Go to Solution.
Hi @newkingdom
You can create a calculated column in this case:
Payment Amount = IF(
TableName[Type] = "Payment",
TableName[Amount], 0)
I just tested this on my data and it worked. If the data-type of Amount is Number use 0, otherwise use "0"
If you think my solution worked , please 'Accept' it as a solution and give it a like.
Thanks,
Mahesh
Hi @newkingdom
You can create a calculated column in this case:
Payment Amount = IF(
TableName[Type] = "Payment",
TableName[Amount], 0)
I just tested this on my data and it worked. If the data-type of Amount is Number use 0, otherwise use "0"
If you think my solution worked , please 'Accept' it as a solution and give it a like.
Thanks,
Mahesh
Did I answer your question? If so, please mark my post as a solution!
Proud to be a Super User!
Hi @newkingdom ,
Try this:
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
86 | |
73 | |
58 | |
52 |
User | Count |
---|---|
196 | |
125 | |
107 | |
68 | |
65 |