how to calculate the net profit i have cost price and sales price

how to calculate the net profit i have cost price and sales price in product table ! i have cost price in the product table only and i want make a chart or table to show me the net profit of total orders !

@Joseph_Seddik hellooo ya boss could you help me please :slightly_smiling_face:

ازيك يا حسن :slightly_smiling_face:

I remember your app, but can’t figure out from your photos which table is which. Can you please show me the sheet’s tables and make sure the sheet name on the bottom is visible. Thank you.

1 Like

tables

According to your tables, what you need to do in order to calculate profit per order is to subtract the relevant products cost + shipping fees from the total value of the order that you name it “Total Cost”.

To do this you can do the following:

  1. In your OrderDetails table add a new column “Product Cost”. Its formula should be:

    [Product ID].[Cost Price]

  2. The total products cost for your order in Orders table will be:

    SUM([Related OrderDetails][Product Cost])

  3. The total shipping fees for your order in Orders table will be:

    SUM([Related OrderDetails][shipping fees])

  4. Thus, the total profit for your order will be:

    [Total Cost]

    • SUM([Related OrderDetails][Product Cost])
    • SUM([Related OrderDetails][shipping fees])

I noticed that you add the shipping fees to only one item per order in your OrderDetails table. This indicates that you are collecting a shipping fee per order not per item, which is the expected usual practice. Hence, it is better to remove the shipping fee column from the OrderDetails table and add it instead to the Orders table. In this case, the expression should be:

[Total Cost] - [shipping fees]

  • SUM([Related OrderDetails][Product Cost])

Read these:

Dereference Expressions | AppSheet Help Center
List Dereference | AppSheet Help Center

1 Like

حبيبي والله الف شكر :folded_hands: :folded_hands: :folded_hands:

You are the best its working as usual from you , thank you so much :blush: :heart_eyes: :folded_hands:

1 Like

تسلم، بسيطة يا صديقي --<@

1 Like

boss hello i would like ask about something firstly everything work great and i can now know the net profit and i removed the shipping fees from order details as you told me and i add it in orders table but i have a problem with total cost , before was, SUM ( SELECT (OrderDetails[Total], [Order Id] = [_THISROW].[Order Id])) , now i want add the shipping fees in the total cost , how its work !

@Joseph_Seddik i solved i used this expression and its work [shipping fees]

  • SUM([Related OrderDetails][total])
1 Like

Right!

انت بقيت أستاذ :grinning_face:

1 Like

دا انت الاستاذ والله بنتعلم منك :heart_eyes:

@Joseph_Seddik i would like to ask another question what if i want know the profit by the month ! ( i dont have any row of month’s or tables )

The easiest way is to add “Month” and “Year” columns. This will allow you to group by these columns in the view and display the sum automatically.

ok add them in order table right ! and month columns make it enum and the monthes or make it taxt type and add the month table and jan feb .. in the google sheet ! which better !

Enum with app formula:

INDEX({“Jan”, “Feb”, … , “Nov”, “Dec”}, MONTH([date]))

1 Like

its give me this massage i dont have date column

Order date?

and instead of the “…” you should complete the list of months

1 Like

حبيبي تسلم يا باشا

done ya king its working now thank you so much :folded_hands:

1 Like

@Joseph_Seddik this massage come to me !

Enter the months one by one in order in the allowed values of the enum column.