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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.