Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
10 years ago
Solved

Next Year calculation (dynamically) through FILTER() and Slicer

Hi All,

 

I am trying to get next year value (dynamically through Year Slicer), but not able to do that. I am using below DAX to calculate next year value. It is returning blank.

 

Measure = CALCULATE(SUM(Sheet5[Value]),FILTER(Sheet5,Sheet5[Year] = ALLSELECTED(Sheet5[Year])+1))

 

I also have slicer on Year. I also tried to use other functions like NEXTYEAR, but not able to do it. I think FILTER() is not accepting any measure or calculation (like +1). 

 

Could someone help on this one?

 

Thank you in advance!

 

Regards,

Niket Talati

  • hi Anonymous
     
    This should works
     
    Medida-SUMofValues-NextYear =
    VAR Next_Year =
        IFERROR ( VALUES ( 'Tabla Años'[Year] ) + 1BLANK () )
    RETURN
        CALCULATE ( SUM ( 'Tabla Años'[Value] ); 'Tabla Años'[Year] = Next_Year 
     
    Let me know.

16 Replies

  • ankitpatira's avatar
    ankitpatira
    Icon for Community Champion rankCommunity Champion

    Anonymous so for example, are you trying to get value 2016 when you select 2015 in Slicer ?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Ankit,

       

      Thanks for your quick response. Yes, when I select 2015 in slicer value, then 2016 should be passed as filter in the table do the calculation. I also have one date master table and I tried all the options, but doesn't work.

       

      Regards,

      Niket Talati

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Sdjensen,

       

      Thanks for your response.

       

      I have a date master table and I tried your formula, but doesn't work for me. I have Year slicer and according to the selected year, next year (suppose I select 2015, then 2016 should be passed in that DAX) should be passed in DAX and do the calculation.

       

      Regards,

      Niket Talati

  • Baskar's avatar
    Baskar
    Icon for Resident Rockstar rankResident Rockstar

    Hi Talat,

     

    Please check with the DAX Query

     

    Next Year Value = CALCULATE(SUM('Date Master'[DayOfMonth]),PARALLELPERIOD('Date Master'[Date].[Date],-1,YEAR))

     

    Let me know it working fine...

     

    Note :

    Prob with your query is once the context filter apply then next year value we can get it. Tha is the issue.

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Baskar,

       

      Thanks for your response.

       

      I am not able to get what you have written. I have date master table but the thing is next year should be calculate based on the current selected year from Slicer. Could you explain your formula more in detail (in perspective to Year Slicer selection)?

       

      Regards,

      Niket Talati

      • Baskar's avatar
        Baskar
        Icon for Resident Rockstar rankResident Rockstar

        Next Year Value =

        CALCULATE( SUM(Value)  ,PARALLELPERIOD("Your Date Field",-1,YEAR))