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
leonardopp
Regular Visitor

Date of second client order

Hi all,

Im trying to calculate the repurchase% of my clients. For that i created one new column at my client table that shows me the date of the first order of my client.

First Buy = FIRSTDATE('Vendas com Produtos'[DATA_EMISSAO_NF])

After that I need to create anothe column at my client table that shows me the date of the second order. 

Second Buy = ??????

I tried to filter this firstdate formula, but it did not work.

My sales table have the clientID and the sales date.

 

I need help on this.

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@leonardopp

 

Try this

 

Second Buy =
VAR FirstBuy = [First Buy]
RETURN
    CALCULATE (
        MIN ( 'Vendas com Produtos'[DATA_EMISSAO_NF] ),
        'Vendas com Produtos'[DATA_EMISSAO_NF] > FirstBuy
    )

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

@leonardopp

 

Try this

 

Second Buy =
VAR FirstBuy = [First Buy]
RETURN
    CALCULATE (
        MIN ( 'Vendas com Produtos'[DATA_EMISSAO_NF] ),
        'Vendas com Produtos'[DATA_EMISSAO_NF] > FirstBuy
    )

Screenshot_1.png
I got this error when tried this formulad.

"The expression contains many columns, but it can only be uses one columns in one expression True/False..."

Sorry, My mistake. It worked just fine. Thanks

@leonardopp

 

Because you didn't use the variable as the last expression inside Filter

 

 

Just replace

 

Clientes[Preimeria Compra]

 

with

 

Firstbuy

 

Also the variable is supposed to hold the FIRSTBUY measure

 

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.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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