Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi all,
I have a strange situation/model where the header has some sales ID records and amounts which have no corresponding lines in the child/many side. I need to sum all the values from the header where there are no matching lines. This is a one to many relationship between header and lines.
Example:
Sales Header (parent)
Sales Key Sales Amount
1 500
2 300
3 100
4 200
Sales Lines
Sales Key Line#
1 1
1 2
2 1
What I'd need is the sum amount from the header rows for Sales Key 3 and 4 in the above example, which would return 300. If we did a left outer join it would be the null rows.
Essentially I need to CALCULATE(SUM(SalesHeader[Amount]), FILTER(SalesHeader, SalesHeader[Sales Key]
NOT IN (SalesLines[Sales Key])
Obviosuly the above is incorrect as I'm not sure how to express NOT IN [list of values in related table] by using DAX. Any help is wonderful!
Solved! Go to Solution.
Then use VALUES(SalesLines[Sales Key]) to create a table of values for it to use.
NOT is available in DAX though. The syntax would look like this:
CALCULATE(SUM(SalesHeader[Amount]), FILTER(SalesHeader, NOT(SalesHeader[Sales Key] IN SalesLines[Sales Key])))
This doesn't seem to work, unfortunately.
After the IN statement, I cannot specify a column name, it's looking for a measure or table for some reason.
Then use VALUES(SalesLines[Sales Key]) to create a table of values for it to use.
Ah, of course. Worked like a charm, thank you!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
72 | |
68 | |
41 | |
35 |
User | Count |
---|---|
108 | |
56 | |
52 | |
48 | |
41 |