Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

DAX expression

Hi,   I have data in the following format: I need to find the max of month in each year, the expected output is like this: Year            Month max 2019           12 2020            5  ...
  • Adescrit's avatar
    4 years ago

    Hi Anonymous ,

     

    You can create it as a measure like this:

     

    Max Month in Year Measure = 
        CALCULATE( MAX('Date'[Month]),'Date'[Year] = SELECTEDVALUE('Date'[Year]))

     

    Or you can create a column like this:

     

    Max Month in Year = 
        CALCULATE( MAX('Date'[Month]), FILTER('Date', 'Date'[Year] = EARLIER('Date'[Year]) ))