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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
twanahc
Frequent Visitor

How can i subtract a credit note value from a sales invoice and then have the credit note deleted

Hi,

I have a dataset containing all our invoice numbers.

Each invoice number has a classification; a) Sale or b) Credit note (return of that sale or parts of it).

In the dataset contains the quantity that we sent an invoice for whether or not it is a sale(positive) or a credit note/return(negative).

 

Each credit note is in turn attached to a sale and the same on the other way around.

 

An example:
Sale 1001 is connected to Credit note 1002. - Quantity +10 on 04/01/2018

Credit note 1002 is connected to Sale 1001 - Quantity (-4,5) on 11/01/2018

 

I would like the credit note that is attached to the sale to be located, subtracted from the sale and then the credit note gets deleted thereafter.

 

 

Any idea on how i can do this?

2 REPLIES 2
Anonymous
Not applicable

@twanahc

 

Assuming you have a way (column) to identify the corresponding sale for a credit note, your table can look like below -

InvoiceTypeAmountCorresponding to Sale
123Sales1000123
124Credit Note-200123
125Sales1200125
126Credit Note-250125
127Sales1000127
128Credit Note-800127
129Sales300129
130Credit Note-300129
131Sales200131
132Credit Note-50131

 

If so, you can create a measure as below - 

NetSales = CALCULATE(SUM(Sales_CN[Amount]),
ALLEXCEPT(Sales_CN,Sales_CN[Corresponding to Sale]) )

 

This will give you the Net Sales for each of the invoice and table visual can look like below...

Note that I have put in a page level filter to include only "Sales" (i.e. no credit notes)

 

Table1.PNG

v-yuta-msft
Community Support
Community Support

Hi twanahc ,

 

What's your data structure and expected result? Could you please clarify more details about your requirement?

 

Regards,

Jimmy Tao

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.