Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
I hope that you can help me with this.
I have 3 tables with the following relationships:
[Fees]*--->1[Cases]1<---*[Financial]
I would like to have a measure to calculate the number of cases that are in [Fees] but not in [Financial]
I have a card with the following measure:
NrCasesFee&NOPayment = CALCULATE ( DISTINCTCOUNT(Fees[CaseID]); FILTER ( ALL (Fees[CaseID]); CALCULATE(SUM(Financial[Amount Paid]))=0 ) )
Solved! Go to Solution.
I see
You have to modify the filtering in the CALCULATETABLE then. Right now we are just filtering for amount > 0 and that is why the row > 0 is taken into account. You want SUM(amount) > 0 as we do working out the second listing.
NrCasesPayment&NOFee = COUNTROWS ( EXCEPT ( FILTER ( DISTINCT ( Financial[CaseID] ); CALCULATE ( SUM ( Financial[Amount Paid] ) ) > 0 ); FILTER ( DISTINCT ( Cases[CaseID] ); CALCULATE ( SUM ( Fees[Amount Paid] ) ) > 0 ) ) )
which if I'm not mistaken should be equivalent to this with your set-up:
NrCasesPayment&NOFee = COUNTROWS ( EXCEPT ( FILTER ( DISTINCT ( Cases[CaseID] ); CALCULATE ( SUM ( Financial[Amount Paid] ) ) > 0 ); FILTER ( DISTINCT ( Cases[CaseID] ); CALCULATE ( SUM ( Fees[Amount Paid] ) ) > 0 ) ) )
and to this:
NrCasesPayment&NOFee = COUNTROWS ( EXCEPT ( FILTER ( DISTINCT ( Financial[CaseID] ); CALCULATE ( SUM ( Financial[Amount Paid] ) ) > 0 ); FILTER ( DISTINCT ( Fees[CaseID] ); CALCULATE ( SUM ( Fees[Amount Paid] ) ) > 0 ) ) )
For this to work well, all IDs with payment in 'Financials' would need to be in 'Fees' (either with or without payment). That seems not to be the case. The missing ones will not be removed by the EXCEPT.
A safer, less restrictive option is to go with INTERSECT:
NrCases Payments&Fees2 = COUNTROWS( INTERSECT( FILTER( DISTINCT (Financial_Combined[Job No.]); CALCULATE ( SUM (Financial_Combined[Amount Paid DKK]))>0 ); FILTER ( DISTINCT (Fees[CaseID]); CALCULATE (SUM (Fees[FeeAmountDKK])) > 0 ) ) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
98 | |
78 | |
66 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |