Forum Discussion

sverderame's avatar
sverderame
Helper I
3 years ago
Solved

Obtaining a row value when using "Less than or equal too slicer (Year)

Obtaining a single row value when using "Less than or equal too slicer (Year)

 

I have a table that has 32 rows oy yearly values (year 2000 - 2032), each row has a widget value for its associated year. I am using a few kpi visuals that are working great with this slicer. 

 

Using the CARD visual.

 

When I move the slider to the year 2015 (essentially 2000 - 2015) the value returned on the CARD is the summation of each row value from 2000 - 2015, which is logical. 

 

What I'd like to know is... Is there a way to return the value of the max year of the slider slicer. example from above is that I would like to just return the value of the year 2015 in the CARD.

 

Thank you.

  • Hi,

    I do not know how your data model looks like, but I tried to create a sample pbix file like below.

    Please check the below picture and the attached pbix file.

    I hope the below can provide some ideas on how to create a solution for your data model.

     

     

     

    Value maxyear measure: =
    CALCULATE ( [Value total measure:], 'Year'[Year] = MAX ( 'Year'[Year] ) )
    
  • Jihwan_Kim's avatar
    Jihwan_Kim
    3 years ago

    Hi,

    Thank you for your message, and please check the below picture and the attached pbix file.

     

    Value 2010 measure: = 
    CALCULATE ( [Value total measure:], 'Year'[Year] = 2010 )
    

7 Replies

  • Hi,

    I do not know how your data model looks like, but I tried to create a sample pbix file like below.

    Please check the below picture and the attached pbix file.

    I hope the below can provide some ideas on how to create a solution for your data model.

     

     

     

    Value maxyear measure: =
    CALCULATE ( [Value total measure:], 'Year'[Year] = MAX ( 'Year'[Year] ) )
    
    • sverderame's avatar
      sverderame
      Helper I

      Hi, I just thought of another scenario I may want to have. I would also like to be able to return the value of say year 2010 (10) regardless of where the year slider is positioned. 

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Super User

        Hi,

        Thank you for your message, and please check the below picture and the attached pbix file.

         

        Value 2010 measure: = 
        CALCULATE ( [Value total measure:], 'Year'[Year] = 2010 )
        
  • Hello, for some reason this DAX is not working for me. It applies the correct value from 2010 and higher but when I select 2009, the value turns "Blank"

     

    Everything in your files seems to match mine, the relationships seem to be in order. I can't figure out why it is not working when I select a year previous to 2010.

  • I found where the glitch is. Its becasue I am using a dates table for the slicer, when I select Dates, hierachy, years it does not work. If I select, years on its own, it works perfectly, however, the slicer now, instead of just showing the years shows a month, day, year format that ruins my other visuals.

  • I figured out how to apply the correct date, that's all that was needed. Thanks again for all of your help!