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

Don'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.

Reply
BIEnthu
Regular Visitor

New customer with first invoice date and amount

Hi

I am trying to create report with customer name their first invoice date and invoice amount. I have a customer table and invoice date and invoice tables.

 

I am using DAX 

Min_Date = CALCULATE(MIN('Invoice'[Invoice Date]), ALLEXCEPT('CustomerTable', 'CustomerTable'[Customer Name]))
 
I am getting multiple records for the same customer with each invoice date. how can i get only the first customer row. 
I tried multiple things like getting the first appearance and also using filter on TOPN, it is not helping.
 
Any recommendations is much appreciated. Thank you for your help in advance

 

7 REPLIES 7
sangeethray_92
Frequent Visitor

@BIEnthu 

If tou just want to use measure. Try this. 

First_Invoice_Date =
CALCULATE(
MIN('Invoice'[Invoice Date]),
ALLEXCEPT('Invoice', 'Invoice'[customer id])
)

 

First_Invoice_Amount =
VAR FirstDate = CALCULATE(
MIN('Invoice'[Invoice Date]),
ALLEXCEPT('Invoice', 'Invoice'[customer id])
)
RETURN
CALCULATE(
SUM('Invoice'[Invoice Amount]),
'Invoice'[Invoice Date] = FirstDate
)

 


Did I answer your question? Mark my post as a solution! And Kudos are appreciated

 

sangeethray_92
Frequent Visitor

create a calculated column in the invoice table. 

 

first_date =
VAR A = CALCULATE(
MIN('Invoice'[Invoice Date]),
ALLEXCEPT('Invoice', 'Invoice'[customer id])
)
RETURN
IF(A = 'Invoice'[Invoice Date], 1, 0)

Use rhis column in the visual level filter and filter for 1. 

this post helps, then please give us Kudos and consider accepting it as a solution to help other members find it more quickly.

 

BIEnthu
Regular Visitor

Thank you bhanu_gautam and Yulia Xu for your inputs! 

I have 3 tables under this scenario. This is MS Fabric and i don't have option to create new/custom column

 

Invoice Amount:

Net Amount  
   
   
   
   
   

Invoice Date

Invoice Datecreation date
  
  

Customer

NameAddress zipRep
Life Financials20 Lincoln Ave51231Nicole
State Electric500 Group Dr62312Jane

Life Financials

20 Lincoln Ave51231Nicole

 

sangeethray_92
Frequent Visitor

Are you trying to display the first record of the customer ?  @BIEnthu 

Yes, looking to display the first first record of each customer. Thanks!

v-xuxinyi-msft
Community Support
Community Support

Hi @BIEnthu 

 

Thanks for the reply from bhanu_gautam .

 

BIEnthu , I have created a simple example data for testing, according to the test if there is a relationship between the two tables then every customer can get the earliest invoice date correctly, is there a relationship between your two tables? If my data structure is different from yours, could you please provide the sample data about both tables so that we can help you better? How to provide sample data in the Power BI Forum - Microsoft Fabric Community Please remove any sensitive data in advance.

 

My sample:

vxuxinyimsft_0-1738739783696.png

 

vxuxinyimsft_1-1738739800352.png

 

vxuxinyimsft_2-1738739832253.png

 

vxuxinyimsft_3-1738739846737.png

 

If there is no relationship between the two tables, the result will not be what you need.
vxuxinyimsft_4-1738739891444.png

vxuxinyimsft_5-1738739906263.png

 

Best Regards,
Yulia Xu

 

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

bhanu_gautam
Super User
Super User

@BIEnthu Create a calculated column for the first invoice date:

FirstInvoiceDate =
CALCULATE(
MIN('Invoice'[Invoice Date]),
ALLEXCEPT('CustomerTable', 'CustomerTable'[Customer Name])
)

 

Create a calculated column for the first invoice amount:

FirstInvoiceAmount =
CALCULATE(
FIRSTNONBLANK('Invoice'[Invoice Amount], 1),
FILTER(
'Invoice',
'Invoice'[Invoice Date] = EARLIER('CustomerTable'[FirstInvoiceDate])
)
)

 

Create a summary table to display the results:

CustomerFirstInvoiceSummary =
SUMMARIZE(
'CustomerTable',
'CustomerTable'[Customer Name],
'CustomerTable'[FirstInvoiceDate],
'CustomerTable'[FirstInvoiceAmount]
)

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.