Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
I have datamodel with two tables - table with sales (id, amount) and second table with incorrect payments (id, reason). Tables are connected by relationship on Id in both tables (in other words sales table contains all ids and incorrect payments has some ids from sales). I want to create sum of amounts from sales table, with excluded payments from incorrect payments table.
I know that I could make join in powerquery, but I would like to use measure instead. I have tried something like below, but it didn't work. Any ideas?
CALCULATE(SUM('sales'[amount]),ISBLANK('incorrect payments'[Id]))
Thank you
Solved! Go to Solution.
I made 2 dummy tables to replicate the story you have provided. This essentially lets you search sum the Sales[Amount] by filtering out rows where the Sales ID exists in the Incorrect Payments table.
Sales
Sales ID | Amount |
1 | $50 |
2 | $100 |
3 | $150 |
4 | $100 |
5 | $250 |
6 | $100 |
7 | $150 |
8 | $110 |
9 | $125 |
10 | $108 |
Incorrect Payment
Sales ID | Reason |
4 | Declined Payment |
8 | Invalid Payment Method |
9 | Declined Payment |
10 | Duplicate Payment |
Sales Excluding Failed Payment =
VAR _VariableTable =
CALCULATETABLE (
VALUES ( 'Incorrect Payments'[Sales ID] ),
ALLSELECTED ( 'Incorrect Payments' )
)
RETURN
SUMX (
FILTER ( ALLSELECTED ( Sales ), NOT ( Sales[Sales ID] ) IN _VariableTable ),
Sales[Amount]
)
I made 2 dummy tables to replicate the story you have provided. This essentially lets you search sum the Sales[Amount] by filtering out rows where the Sales ID exists in the Incorrect Payments table.
Sales
Sales ID | Amount |
1 | $50 |
2 | $100 |
3 | $150 |
4 | $100 |
5 | $250 |
6 | $100 |
7 | $150 |
8 | $110 |
9 | $125 |
10 | $108 |
Incorrect Payment
Sales ID | Reason |
4 | Declined Payment |
8 | Invalid Payment Method |
9 | Declined Payment |
10 | Duplicate Payment |
Sales Excluding Failed Payment =
VAR _VariableTable =
CALCULATETABLE (
VALUES ( 'Incorrect Payments'[Sales ID] ),
ALLSELECTED ( 'Incorrect Payments' )
)
RETURN
SUMX (
FILTER ( ALLSELECTED ( Sales ), NOT ( Sales[Sales ID] ) IN _VariableTable ),
Sales[Amount]
)
That's exactly what I needed! Thank you so much!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
106 | |
75 | |
44 | |
39 | |
33 |
User | Count |
---|---|
165 | |
90 | |
65 | |
46 | |
43 |