Forum Discussion

kylebi1's avatar
kylebi1
Frequent Visitor
7 years ago

Filter Latest Date and Value for each Row

I have a table that looks like the following:

 

NameWorkgroupActiveModified Date Time
KyleA110/7/2018
KyleA010/8/2018
KyleB010/7/2018
KyleB110/8/2018
JohnB110/7/2018
JohnB010/8/2018
JohnA010/7/2018
JohnA110/8/2018

 

I need the latest value for each [Workgroup] by [Name]

 

For example: Kyle's workgroup A was active 10/7/18, but has been de-activated on 10/8/18. 

 

Kyle's current stats for [Workgroup] A is de-activated.

 

I need to then put the sum of the activations in a table that can display how many users are active in the respective workgroup. 

 

I was able to get halfway there with a measure that filtered the max date for the active status. However, it does not work for the table. 

7 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    So, can you explain the expected results from the sample data presented and to logic to arrive at that result?

    • kylebi1's avatar
      kylebi1
      Frequent Visitor

      Hi Greg_Deckler

       

      I need the current status for each user and their workgroup. I was able to filter for the latest modified date time for each workgroup using this measure:

       

      CALCULATE(SUM(   'Workgroup Table'[ActivationFlag]), FILTER('Workgroup Table', 'Workgroup Table'[ActivationDateTime]=MAX('Workgroup Table'[ActivationDateTime])))

       

       

    • kylebi1's avatar
      kylebi1
      Frequent Visitor

      This is what the table looks like:

       

      I need this to only show me the most current value for of ActivationFlag by filtering ActivationDateTime for each name and each workgroup.

      • MarkLaf's avatar
        MarkLaf
        Super User

        I think you basically have it - does it work if you use LASTNONBLANK instead of SUM in the calc?

         

        CALCULATE(LASTNONBLANK(Table1[Active],Table1[Active]),FILTER(Table1,MAX(Table1[Modified Date Time])=Table1[Modified Date Time]))