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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Calculating the sum of the value of an order

Hello everyone,

 

I need to calculate the sum of the values of the items in a Sales Order.

 

My report works with three tables: 

  • Sales Order table: contains all the sales orders, each identified by a unique code, and all the items inside the SO. If a SO contains more than one item, more rows with the same SO are displayed.

    SO code   Item Code
    SO10002
    SO20002
    SO20001
    SO30004
    SO40005
    SO50003
    SO50001
    SO50002
  • Item Fulfillment table: contains all the fulfillments of sales orders. Each IF is identified by a unique code. A SO can be fulfilled with more than one IF, in which case, more rows  with the same IF are displayed.

    IF code   SO code
    IF1SO1
    IF2SO1
    IF3SO1
    IF4SO3
    IF5SO5
    IF6SO2
    IF7SO2
  • Item List: contains all the items and their cost.

    Item Code   Last Year Cost 
    0001                4,64 €
    0002                4,76 €
    0003                2,54 €
    0004                4,48 €
    0005                5,22 €

I built a view based on the IF table. It displays the Sales Orders in the IF table and, when drilling-down to the second level, all the IFs related to that SO. I want to display on another column of the same view the sum of the costs of the items contained in the SO in each row.

 

Thank you very much for your help!  

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous,

You can try to use the following measure formula on your ‘IF’ table visuals to show the correspond sales:

formual =
VAR ItemCodeList =
    CALCULATETABLE (
        VALUES ( 'Sales Order'[Item Code] ),
        FILTER (
            ALLSELECTED ( 'Sales Order' ),
            [SO Code] IN VALUES ( 'Item Fulfillment'[SO Code] )
        )
    )
RETURN
    CALCULATE (
        SUM ( 'Item List'[Last Year Cost] ),
        FILTER ( ALLSELECTED ( 'Item List' ), [Item Code] IN ItemCodeList )
    )

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous,

You can try to use the following measure formula on your ‘IF’ table visuals to show the correspond sales:

formual =
VAR ItemCodeList =
    CALCULATETABLE (
        VALUES ( 'Sales Order'[Item Code] ),
        FILTER (
            ALLSELECTED ( 'Sales Order' ),
            [SO Code] IN VALUES ( 'Item Fulfillment'[SO Code] )
        )
    )
RETURN
    CALCULATE (
        SUM ( 'Item List'[Last Year Cost] ),
        FILTER ( ALLSELECTED ( 'Item List' ), [Item Code] IN ItemCodeList )
    )

Regards,

Xiaoxin Sheng

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.