This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hello community,
How would you solve this case where we need to verify whether a two step invoice approval process is legitimate or not?
I have two tables containing information about given approvals in phase A and phase B, and want to see if the invoices have been approved in accordance with the regulation.
Rules:
An alternate way of declaring the rules: Remove all B approvers from the A approvers set; if there are any remaining approvers then the process is legitimate.
Sample tables:
Phase A
InvoiceID_A | UserID_A |
A | John |
A | Sarah |
A | Brad |
B | Brad |
C | Brad |
D | Jane |
D | Sarah |
E | Jane |
Phase B
InvoiceID_B | UserID_B |
A | Sarah |
B | John |
B | Sarah |
C | Sarah |
C | Brad |
D | John |
D | Sarah |
D | Brad |
D | Jane |
E | Jane |
Expected Result
InvoiceID | (Result_UserIDs) | Result |
A | (null) | False |
B | John, Sarah | True |
C | Sarah | True |
D | John, Brad | True |
E | (null) | False |
Best Regards,
Daniel
Solved! Go to Solution.
Hi @Daniel_L
Will this strategy work for you?
First create a new table with the distinct InvoiceIDs like this
InvoiceID =
DISTINCT (
UNION ( VALUES ( 'Phase A'[InvoiceID_A] ); VALUES ( 'Phase B'[InvoiceID_B] ) )
)Then create a new calculated column using this code
Number of =
VAR phaseA_approvers =
CALCULATETABLE (
VALUES ( 'Phase A'[UserID_A] );
FILTER ( VALUES ( 'Phase A' ); 'Phase A'[InvoiceID_A] = InvoiceID[InvoiceID] )
)
VAR phaseB_approvers =
CALCULATETABLE (
VALUES ( 'Phase B'[UserID_B] );
FILTER ( VALUES ( 'Phase B' ); 'Phase B'[InvoiceID_B] = InvoiceID[InvoiceID] )
)
VAR phaseB_approvers_not_approvers_phaseA =
FILTER ( phaseB_approvers; NOT ( [UserID_B] IN phaseA_approvers ) )
RETURN
IF (
COUNTROWS ( phaseB_approvers_not_approvers_phaseA ) > 0;
TRUE ();
FALSE ()
)Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
Hi @Daniel_L
Will this strategy work for you?
First create a new table with the distinct InvoiceIDs like this
InvoiceID =
DISTINCT (
UNION ( VALUES ( 'Phase A'[InvoiceID_A] ); VALUES ( 'Phase B'[InvoiceID_B] ) )
)Then create a new calculated column using this code
Number of =
VAR phaseA_approvers =
CALCULATETABLE (
VALUES ( 'Phase A'[UserID_A] );
FILTER ( VALUES ( 'Phase A' ); 'Phase A'[InvoiceID_A] = InvoiceID[InvoiceID] )
)
VAR phaseB_approvers =
CALCULATETABLE (
VALUES ( 'Phase B'[UserID_B] );
FILTER ( VALUES ( 'Phase B' ); 'Phase B'[InvoiceID_B] = InvoiceID[InvoiceID] )
)
VAR phaseB_approvers_not_approvers_phaseA =
FILTER ( phaseB_approvers; NOT ( [UserID_B] IN phaseA_approvers ) )
RETURN
IF (
COUNTROWS ( phaseB_approvers_not_approvers_phaseA ) > 0;
TRUE ();
FALSE ()
)Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 28 | |
| 23 | |
| 22 | |
| 16 | |
| 16 |
| User | Count |
|---|---|
| 61 | |
| 35 | |
| 28 | |
| 22 | |
| 22 |