Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Formula adapt to current year

Hey Guys,   I need help with the following formula: Toolbox vereist 2 = CALCULATE(IF( YEAR (MAX(Datum[Datum]))= YEAR( NOW()), 10/12 * ((CALCULATE(DISTINCTCOUNT(Datum[Maand]), personen[afdeling...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Anonymous ,

    I created some data:

    Here are the steps you can follow:

    1. Create calculated table.

    Table 2 =
    CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))

    2. Create measure.

    Measure_today =
    var _select=SELECTEDVALUE('Table 2'[Year])
    return
    IF(
        _select = YEAR(TODAY()),
    CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Date]>=DATE(2020,1,1)&&'Table'[Date]<=TODAY()&&'Table'[afdeling] in {"BPM","Asfalt"})))
    Measure_Month =
    var _select=SELECTEDVALUE('Table 2'[Year])
    return
    IF(
        _select = YEAR(TODAY()),
    CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Date]>=DATE(2020,1,1)&&'Table'[Date]<=EOMONTH(TODAY(),0)&&'Table'[afdeling] in {"BPM","Asfalt"})))

    3. Result:

     

    Best Regards,

    Liu Yang

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