Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Max Month Number per Year

Hello All,

 

I'm wanting to return the max monthnumber for each year. For the example below 2018 would return 12 AND 2019 will return 9. I will then be using that calculation to divide a measure to get a average for the year. 

 

 
 
 
 
  • Anonymous ,

     

    Create a below meaure to get Max monthnumber.

     

    Max Month Number = CALCULATE(Max(Sheet9[MonthNumber]),ALLEXCEPT(Sheet9,Sheet9[Year]))
     
    Don't forget to hit Thumbs up and accept this as a solution if you find it helpful! 

10 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable
     
    12018
    102018
    112018
    122018
    62018
    72018
    52018
    92019
    42019
    12019
    22019
    32019
    52019
      
    • Tahreem24's avatar
      Tahreem24
      Icon for Super User rankSuper User

      Anonymous ,

       

      Create a below meaure to get Max monthnumber.

       

      Max Month Number = CALCULATE(Max(Sheet9[MonthNumber]),ALLEXCEPT(Sheet9,Sheet9[Year]))
       
      Don't forget to hit Thumbs up and accept this as a solution if you find it helpful! 
      • Anonymous's avatar
        Anonymous
        Not applicable

        Tahreem24 

         

        Thank you,

         

        When doing this formula I'm getting 9 for both the years 

    • nvprasad's avatar
      nvprasad
      Icon for Solution Sage rankSolution Sage

      Hey,

       

      Here is two forumulas you can use either.

       

      1.Maxmonth = MAX('Table'[Number])

       

      2.MaxMonth = CALCULATE(MAX('Table'[Number]),FILTER('Table','Table'[Year]=SELECTEDVALUE('Table'[Year])))

       

      Thanks,

      Venkata Nalla