Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

DYNAMIC FILTER - CURRENT MONTH + PREV MONTH

Hi Community,

 

Need your support on the following challenge. I would like to get a calculated column that would update its values according to the month where the calendar in the dashboard. Issue is that apparently this function does not allow to FILTER by text and date

 

Horas_Prev_Month = CALCULATE(SUM(t_Planeamento[Horas]);
FILTER(t_Planeamento; t_Planeamento[Planeamento] = "Variação");
FILTER(t_Planeamento; t_Planeamento[Data] = [CurrentMonth])
)
 
Anyone can help me to achieve this ? 
Thank you all! 
NM 
  • Hi Anonymous 

     

    You may try below measure:

    Horas_Current_Month =
    CALCULATE (
        SUM ( t_Planeamento[Horas] ),
        FILTER ( t_Planeamento, t_Planeamento[Planeamento] = "Variação" ),
        FILTER ( t_Planeamento, MONTH ( t_Planeamento[Data] ) = [CurrentMonth] )
    )
    
    Horas_Prev_Month =
    CALCULATE (
        SUM ( t_Planeamento[Horas] ),
        FILTER ( t_Planeamento, t_Planeamento[Planeamento] = "Variação" ),
        FILTER ( t_Planeamento, MONTH ( t_Planeamento[Data] ) = [CurrentMonth]-1 )
    )

    Regards,

    Cherie

2 Replies

  • v-cherch-msft's avatar
    v-cherch-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Anonymous 

     

    You may try below measure:

    Horas_Current_Month =
    CALCULATE (
        SUM ( t_Planeamento[Horas] ),
        FILTER ( t_Planeamento, t_Planeamento[Planeamento] = "Variação" ),
        FILTER ( t_Planeamento, MONTH ( t_Planeamento[Data] ) = [CurrentMonth] )
    )
    
    Horas_Prev_Month =
    CALCULATE (
        SUM ( t_Planeamento[Horas] ),
        FILTER ( t_Planeamento, t_Planeamento[Planeamento] = "Variação" ),
        FILTER ( t_Planeamento, MONTH ( t_Planeamento[Data] ) = [CurrentMonth]-1 )
    )

    Regards,

    Cherie

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you very much Cherie!