Forum Discussion

dannyboy123's avatar
dannyboy123
Frequent Visitor
2 years ago
Solved

Filtering a measure

Hi.

 

I have the following data in a table...

The left hand column is week number.  I want to create a measure that always returns the latest week only.  I've been trying for a few hours and it's barely worth showing my efforts as I've got nowhere 🙂

 

Any help much appreciated

  • Try this:

    First create a measure that will get your maximum week:

    LatestWeek = CALCULATE(MAX('TableName'[YourWeekColumn]),ALL('TableName')) 

    Then create another measure:

    LatestWeekFlag = LatestWeekFlag = IF(SELECTEDVALUE('TableName'[YourWeekColumn] = [LatestWeek], 1, 0)

    Use it as a filter:

     

1 Reply

  • Try this:

    First create a measure that will get your maximum week:

    LatestWeek = CALCULATE(MAX('TableName'[YourWeekColumn]),ALL('TableName')) 

    Then create another measure:

    LatestWeekFlag = LatestWeekFlag = IF(SELECTEDVALUE('TableName'[YourWeekColumn] = [LatestWeek], 1, 0)

    Use it as a filter: