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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
    )

Regards
Zubair

Please try my custom visuals

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
    )

Regards
Zubair

Please try my custom visuals

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

 


Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.