Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How do I create a summarized table with the latest records based on a date?

Hello,

 

I'm trying to create a calculated table that is summarized with the latest values based on a date slicer.

 

Here is an example:

 

ColumnID UserName UserValue Date

1Charles11/23/2018
1Charles62/15/2018
1Charles44/2/2018
2Lisa43/1/2018
2Lisa83/27/2018
3Sam51/30/2018
4Ashley21/11/2018
4Ashley51/31/2018
4Ashley63/5/2018
4Ashley35/12/2018

 

If I use an As Of Date of 01/28/2018 Id like:

 

ColumnID UserName UserValue Date

1Charles11/23/2018
4Ashley21/11/2018

 

An As Of Date of 03/02/2018

 

ColumnID UserName UserValue Date

1Charles62/15/2018
2Lisa43/1/2018
3Sam51/30/2018
4Ashley51/31/2018

 

AsOF 05/01/2018

 

ColumnID UserName UserValue Date

1Charles44/2/2018
2Lisa83/27/2018
3Sam51/30/2018
4Ashley63/5/2018

 

Many thanks for your help!

  • Hi Anonymous 

    Create a date table without relationship with your table.

    date = CALENDARAUTO()
    add [Date] to the slicer,select "before" from the drop-down list.
     
    Create a measure in your table
    Measure =
    VAR maxselected =
        MAX ( 'date'[Date] )
    VAR max_fit =
        CALCULATE (
            MAX ( 'Table'[Date] ),
            FILTER ( ALLEXCEPT ( 'Table', 'Table'[ColumnID] ), [Date] < maxselected )
        )
    RETURN
        IF ( MAX ( 'Table'[Date] ) = max_fit, 1, 0 )
    

    add [Measure] to the visual level filter of the table as above

     

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • If the user can use filter pane. Then you can Advance filter. There you have the option for <=. you can use page or visual level filter as per need

     

     

    Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
    Thanks.

  • v-juanli-msft's avatar
    v-juanli-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

    Create a date table without relationship with your table.

    date = CALENDARAUTO()
    add [Date] to the slicer,select "before" from the drop-down list.
     
    Create a measure in your table
    Measure =
    VAR maxselected =
        MAX ( 'date'[Date] )
    VAR max_fit =
        CALCULATE (
            MAX ( 'Table'[Date] ),
            FILTER ( ALLEXCEPT ( 'Table', 'Table'[ColumnID] ), [Date] < maxselected )
        )
    RETURN
        IF ( MAX ( 'Table'[Date] ) = max_fit, 1, 0 )
    

    add [Measure] to the visual level filter of the table as above

     

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.