Forum Discussion

GeekAlfPro's avatar
GeekAlfPro
Helper V
3 years ago

datesbetween different by row

Hello,

 

I'm looking for a way to calculate a difference between two values.

so far so good.

Différence Kms CBu vs Capte = CALCULATE(
    [Somme Kms Electric Final CB]-[Somme Kms Electric Final],
    DATESBETWEEN('Date'[Date],FIRSTDATE('daily_aggregate_final'[Date]),MAX('BDD kms depuis 2019'[Date Kms]))
    )

But the result is not what i'm expecting

My question is the following

each row has a different date "FIRSTDATE('daily_aggregate_final'[Date]"

Do i have to make a calculatetable first ?

 

Thanks

2 Replies

  • Maybe i'm not accurate enough.

    here is a table with different use cases

     

    VehicleDate[Somme Kms Electric Final CB]Date[Somme Kms Electric Final]result
    101/09/20221200024/01/2023750null
    207/10/20221550007/10/20221545050
    301/09/20222375601/09/2023210002756
    415/12/2022782324/01/20233254null

     

     

    Actually, to make it easier to understand if dates of different tables are equals, so i need the result.

     

    Thanks

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi GeekAlfPro 

    Can you provide some sample data , because you mentioned that the dates are from different table, what are the relationship bwtween the tables? If you want to use the condition that the dates are the same, you can use filter() function to find the same date of the different table.

     

    Best Regards!

    Yolo Zhu

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