Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
InsightSeeker
Helper III
Helper III

Invoice / Payment Status Using DAX or Measure

Invoice Payment Status Using DAX or Measure
3 hours ago

I want to get the status of each invoice, indicating whether it is paid, partially paid, or unpaid.

 

- If the invoice total is equal to the paid amount, the invoice should be marked as Paid.

- If the invoice total is greater than the paid amount, the invoice should be marked as Partially Paid.

- If the invoice total is not fully or partially paid, the invoice should be marked as Unpaid.

 

Can this be done using a DAX measure?

 

For PBIX File click here

 

Result

 

Inv_DateInv_NoDocumentSale_AmountInv_AmountPaid_AmountInvoice_Status
1-Jul-238675587575657871200.00             2,510                2,510 Paid 
20-Jul-2386755875777886861310.00                    -                         -   Paid 
3-Jul-2377880787686863210.00             6,770                3,210 Partially Paid 
9-Jul-2377880776576573560.00                    -                         -   Partially Paid 
16-Jul-2377904956998793910.00             3,910                       -   Unpaid 
17-Jul-237791708678684260.00             4,260                4,260 Paid 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @InsightSeeker ,

Thank you for pointing out my problem!

The following DAX might work for you:

Measure = 
  VAR _Inv = SELECTEDVALUE(Sale_1[Inv_Amount])
  VAR _Paid = CALCULATE(MAX(Sale_1[Paid_Amount]),ALLEXCEPT(Sale_1,Sale_1[Inv_No]))
  VAR _Sale = CALCULATE(SUM(Sale_1[Sale_Amount]),ALLEXCEPT(Sale_1,Sale_1[Inv_No]))
  RETURN
    IF(_Paid < _Sale , IF(_Paid = 0 , "Unpaid" , "Partially Paid"),"Paid")

The final output is shown in the following figure:

vxiandatmsft_0-1716357558197.png

Best Regards,

Xianda Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @InsightSeeker ,

The following DAX might work for you:

Measure = 
  VAR _Inv = SELECTEDVALUE(Sale_1[Inv_Amount])
  VAR _Paid = SELECTEDVALUE(Sale_1[Paid_Amount])
  RETURN
  IF(_Paid < _Inv , 
     IF(_Paid = 0 , "Unpaid" , "Partially Paid"),
     "Paid")

The final output is shown in the following figure:

vxiandatmsft_0-1716342206257.png

Best Regards,

Xianda Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous - This measure returns the incorrect status for the Invoice 778807. This invoice is partially paid whereas for one sale it is showing paid.

 

InsightSeeker_1-1716353109259.png

 

 

 

Hi @Anonymous  - My result should be as below.

 

InsightSeeker_2-1716353451785.png

 

Anonymous
Not applicable

Hi @InsightSeeker ,

Thank you for pointing out my problem!

The following DAX might work for you:

Measure = 
  VAR _Inv = SELECTEDVALUE(Sale_1[Inv_Amount])
  VAR _Paid = CALCULATE(MAX(Sale_1[Paid_Amount]),ALLEXCEPT(Sale_1,Sale_1[Inv_No]))
  VAR _Sale = CALCULATE(SUM(Sale_1[Sale_Amount]),ALLEXCEPT(Sale_1,Sale_1[Inv_No]))
  RETURN
    IF(_Paid < _Sale , IF(_Paid = 0 , "Unpaid" , "Partially Paid"),"Paid")

The final output is shown in the following figure:

vxiandatmsft_0-1716357558197.png

Best Regards,

Xianda Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors