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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
REWright
Frequent Visitor

Calculate a Total Units measure with a specific set of SalesID for one (of many) CustomerID

Hi, first, thank you for reading this post.

 

We have a set of specific CustomerIDs that we're beginning to track Total Units sold by SalesOrderID.

The wrinkle is that one specific CustomerID has a list of specific SalesOrderID that are to be included, excluding all of their other SOID.

 

The dataset has been pre-filtered to only include the specific CustomerID that are relevant to this particular report.

 

What I'm looking for is the proper DAX for a new measure (Total Units) that will calculate total units for all SOID for all CustomerID, but only the specific SOID for the one CustomerID.

 

Assume we have CustomerIDs:

CUST0000123

CUST0000234

CUST0000345

CUST0000456

 

Where CUST0000234 is the specific customer that needs to only include the following SalesOrderIDs associated with their account:

SO0000789

SO0000897

SO0000987

 

The very basic report will include Sales Order Date, CustomerID, Customer Name, SalesOrderID, ItemID, Total Units

 

Note: A SalesOrderID can only be associated with one CustomerID.

Note 2: All data elements are sourced from one table 'CurrentSales'

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@REWright,

 

Try this measure:

 

Total Units Sold =
VAR vTable =
    FILTER (
        CurrentSales,
        CurrentSales[CustomerID] <> "CUST0000234"
            || ( CurrentSales[CustomerID] = "CUST0000234"
            && CurrentSales[SalesOrderID] IN { "SO0000789", "SO0000897", "SO0000987" } )
    )
VAR vResult =
    SUMX ( vTable, CurrentSales[UnitsSold] )
RETURN
    vResult




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
DataInsights
Super User
Super User

@REWright,

 

Try this measure:

 

Total Units Sold =
VAR vTable =
    FILTER (
        CurrentSales,
        CurrentSales[CustomerID] <> "CUST0000234"
            || ( CurrentSales[CustomerID] = "CUST0000234"
            && CurrentSales[SalesOrderID] IN { "SO0000789", "SO0000897", "SO0000987" } )
    )
VAR vResult =
    SUMX ( vTable, CurrentSales[UnitsSold] )
RETURN
    vResult




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you. This worked perfectly. Appreciate the quick assistance.  Cheers to you!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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