Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Retrieve value based on latest date

Hi, Need your help in pulling the values based on the latest date. 

 

Following is what I am trying to achieve:

Order DateCustomerAmount
11/5/2015Andy3844
9/8/2014Bill3494
10/2/2015Andy944
5/13/2014Sara589
7/4/2018Ken4380
12/25/2015Andy855
1/19/2016Bill485
3/14/2017Ken8473
6/29/2015Andy4855
   
Result:  
Order DateCustomerAmount
12/25/2015Andy855
1/19/2016Bill485
7/4/2018Ken4380
5/13/2014Sara589

 

I am only looking to achieve this using measures and my data comes from live connection.

 

Appreciate your help,

 

Regards,

SN

  • Hi,  Anonymous 

     

    You can create a measure and put it in filter pane to filter data.

    Like this:

     

    Measure =
    VAR a =
        MAXX (
            FILTER ( ALL ( 'Table' ), [Customer] = SELECTEDVALUE ( 'Table'[Customer] ) ),
            [Order Date]
        )
    RETURN
        IF ( SELECTEDVALUE ( 'Table'[Order Date] ) = a, 1, 0 )
    

     

     

    If you still have problems, please feel free to ask me.

     

    Best Regards

    Janey Guo

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • v-janeyg-msft's avatar
    v-janeyg-msft
    Community Support

    Hi,  Anonymous 

     

    You can create a measure and put it in filter pane to filter data.

    Like this:

     

    Measure =
    VAR a =
        MAXX (
            FILTER ( ALL ( 'Table' ), [Customer] = SELECTEDVALUE ( 'Table'[Customer] ) ),
            [Order Date]
        )
    RETURN
        IF ( SELECTEDVALUE ( 'Table'[Order Date] ) = a, 1, 0 )
    

     

     

    If you still have problems, please feel free to ask me.

     

    Best Regards

    Janey Guo

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Anonymous , Try a new measure like

     


    Measure =
    VAR __id = MAX ('Table'[Customer] )
    VAR __date = CALCULATE ( MAX('Table'[Order Date] ), ALLSELECTED ('Table' ), 'Table'[Customer] = __id )
    CALCULATE ( sum ('Table'[Amount] ), VALUES ('Table'[Customer] ),'Table'[Customer] = __id,'Table'[Order Date] = __date )