Forum Discussion

olepropell's avatar
olepropell
New Member
5 years ago
Solved

Filter visuals with position data to show only current position per tracking unit

Hi. I use Direct Query and receive a dataset with positions from tracking units. Each tracking has a timestamp.   I have two visuals, a table and and a map.   What I want to achieve is a button f...
  • MFelix's avatar
    5 years ago

    Hi olepropell ,

     

    I created a slicer button and a measure to do this.

     

    Create a table for the slicer mine has the following values:

     

    Values

    All Values
    Latest Values

     

    Now create the following measure:

    Latest_Values =
    VAR temp_table =
        SUMMARIZE (
            ALL ( 'Table'[TrackerID], 'Table'[Date], 'Table'[Lat], 'Table'[Long] ),
            'Table'[TrackerID],
            "DATE", MAX ( 'Table'[Date] )
        )
    RETURN
        SWITCH (
            SELECTEDVALUE ( 'Period Selection'[Values] ),
            "All Values", 1,
            IF (
                SELECTEDVALUE ( 'Table'[Date] )
                    = MAXX (
                        FILTER ( temp_table, 'Table'[TrackerID] = MAX ( 'Table'[TrackerID] ) ),
                        [DATE]
                    ),
                1
            )
        )

    Now add this has filter on your visualizations and select all non blank vlaues

     

    Result below and in attach PBIX file.