Forum Discussion

AntonV's avatar
AntonV
Icon for Helper I rankHelper I
3 years ago
Solved

Calculate date range when specific value is reached

Hi all,   I am struggling with a date diff calculation. I have found some similar cases in the community, but I can't seem te figure it out. I hope you can help me 😁   My dataset: Table with c...
  • johnt75's avatar
    johnt75
    3 years ago

    Create a one-to-many relationship from the company table to the summary table, then add a new calculated column to the company table,

    Date reached 30 =
    CALCULATE (
        MIN ( 'Summary Table'[Date] ),
        'Summary Table'[@cumulative commission] >= 30
    )
    

    You can then create a measure like 

    Avg time to 30 =
    AVERAGEX (
        FILTER ( Company, NOT ISBLANK ( Company[Date reached 30] ) ),
        DATEDIFF ( Company[Create date], Company[Date reached 30], DAY )
    )