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

Be 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

Reply
newkingdom
Frequent Visitor

Get only the payment amount from the same table

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.

 

IdAmountType  Payment AMount     
12Payment  2      
13Refun  0      
16Payment  6      
24Payment  4      
24Refund  0      
26Refund  0      
36Something  0     
34Refund  0      
31Payment  1      
41Payment  1      
42Something  0     
45Something  0     
410Payment  10     

 

1 ACCEPTED SOLUTION
hmahesh94
Helper I
Helper I

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

View solution in original post

3 REPLIES 3
hmahesh94
Helper I
Helper I

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

mh2587
Super User
Super User

pay.PNG


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



jppv20
Solution Sage
Solution Sage

Hi @newkingdom ,

 

Try this:

 

Payment_Amount = IF('Table'[Type]="Payment",'Table'[Amount],0)
 
If I answered your question, please mark it as a solution to help other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.