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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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