The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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'
Solved! Go to Solution.
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
Proud to be a Super User!
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
Proud to be a Super User!
Thank you. This worked perfectly. Appreciate the quick assistance. Cheers to you!
User | Count |
---|---|
12 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
24 | |
14 | |
13 | |
9 | |
7 |