Forum Discussion

Timo123's avatar
Timo123
Frequent Visitor
3 years ago

Only show last value in matrix

I have the following tables:


Dates

Values

 

And the following matrix:

 

Weeknumber     Value

1                         50

2                         60

3                         70

4                         80

5                         90

 

I want to create a measure that makes the matrix looks like the example below, moving with a slicer on weeknumbers (so in this example, its 1 to 5, but the value moves if its set to 3 or 6):

 

Weeknumber     Value

1                         

2                         

3                         

4                         

5                         90

 

I tried multiple measures I've found online, but none seem to work. I either get the max value per week or just the max value of week 5 on every week. How do I keep older weeks empty while having a value for the max week selected by the slicer?

 

Thank you in advance!

2 Replies

  • Could you post your current measure? Using Allselected as a condition in Calculate might fix this.

     

    Edit: Okay you want the slicer to only affect the value column. This is a bit complicated. You may need a new table for the data, lets call it T2. Then instead of a matrix use table visualization. Make a new measurement:

    Filtered values = Selectedvalue(T2[Value])

    Use the weeks from T1 as the first column and the values from T2 as the next column, and the slicer will take in weeks from T2.

     

    • Timo123's avatar
      Timo123
      Frequent Visitor

      The end goal for the measure is to have a line chart with 3 values: current year, year -1 and a value marker just for the last week of the current year. So it doesnt necessarily have to be in a matrix or a table, as long as it just takes the value of the current year value of only the last week so I can have dynamic labels in the line chart visual that move when the slider for the weeks moves. 

       

      The easy non-dynamic method would be:

       

      Label = CALCULATE([Value Measure],FILTER('Date','Date'[Year]=YEAR(TODAY())&&'Date'[WeekNum]=WEEKNUM(TODAY())))
       
      which works fine, but means I cant select an older week and have the label move dynamically with the slicer.