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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DennisJung
Helper I
Helper I

Calculate Orders with and without specific items

Hey!

 

It is already friday and i try to finish my report, but i can not solve or create the correct measure for the following Request:

 

- Summarize all orders without  transport costs

- list all orders without transport costs

 

My table looks like this:

Ordernumber | article | quantity | value

0000001 | 100900 | 10 | 2900 €

0000001 | 90 | 1 | 50 €
0000002 | 100500 | 2 | 6000 €
0000003 | 100501 | 3 | 700 €

In this example, 90 is the article number for the transport costs. i need now to sum the orders expect the orders which inclued article 90.

So the result should be 6700 €.


 

Edit:

"IF a order contains the article 90, then ignore / filter the complete order" is basicly what i need

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@DennisJung,

 

You may use the following DAX to add a measure.

Measure =
SUMX (
    FILTER (
        Table1,
        NOT (
            CONTAINS (
                Table1,
                Table1[Ordernumber], Table1[Ordernumber],
                Table1[article], 90
            )
        )
    ),
    Table1[value]
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-chuncz-msft
Community Support
Community Support

@DennisJung,

 

You may use the following DAX to add a measure.

Measure =
SUMX (
    FILTER (
        Table1,
        NOT (
            CONTAINS (
                Table1,
                Table1[Ordernumber], Table1[Ordernumber],
                Table1[article], 90
            )
        )
    ),
    Table1[value]
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Worked! Thank you very much!

vik0810
Resolver V
Resolver V

You can sum up the orders that contain transport cost and then caluclate difference, something like that

 

Orders With Shipping Cost =
CALCULATE (
    SUM ( Table[value] ),
    FILTER ( Table[Ordernumber], Table[article] = 90 )
)

 

orders without Shipping costs = SUM ( Table[value] ) - [Orders With Shipping Cost]

 

May be there is a better solution, but this should work

I already tried something similar like your example, and the problem is that the first order with the transport cost is included, but without the costs for the article 90.

 

So what it basicly does is this:

 

2900 + 6000 + 700

 

But it should also ignore the 2900 € because it is from the same order 000001.

 

"IF a order contains the article 90, then ignore / filter the complete order" is basicly what i need

 

Thats because you fiiltered order positions, not whole orders. Pay attention for the filter function, I provided you in my example. 

Use it just that

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.