Forum Discussion

jimmyfromus's avatar
jimmyfromus
Helper III
5 years ago
Solved

Min value based on year column

Hi, 

 

I've 2 columns, one with year and one with an integer value. 

 

Yearrank
201735
201836

 

I'm simply trying to create a measure for this to calculate the minimum value to use in a card visual.

I have the following but get an error message: 

Measure = CALCULATE (SUM(Comparison[congestion] ), FIRSTDATE ( Comparison[Year] ) )
 
I guess it's not FirstDate I should use, does anyone know how I do this correctly?
 
Thanks. 

 

  • parry2k I used this DAX which seems to work for me. 

     

    Measure = CALCULATE(
    MIN(Comparison[rank]),
    FILTER(ALLSELECTED(Comparison),
    (Comparison[Year] = (MIN( Comparison[Year] )))
    )
    )

3 Replies

    • jimmyfromus's avatar
      jimmyfromus
      Helper III

      parry2k, Ok, so I've a table with 2 columns, year and rank(both are whole number columns). I've a slicer using the year and then a card visual using the min value of the rank. When no year is selected in the slicer, the year value is picked up as 2017 in the card visual and the rank (min value) is shown as 14 in the card visual. I would however like that the year value is 2017 but the rank value is shown as 15. What measure would I need to use to do this? 

       

    • jimmyfromus's avatar
      jimmyfromus
      Helper III

      parry2k I used this DAX which seems to work for me. 

       

      Measure = CALCULATE(
      MIN(Comparison[rank]),
      FILTER(ALLSELECTED(Comparison),
      (Comparison[Year] = (MIN( Comparison[Year] )))
      )
      )