Reply
Frequent Visitor
Posts: 9
Registered: ‎05-16-2018
Accepted Solution

Show only data from the latest date

Dear all,

I have a very basic question. I constantly struggle with showing only the data with the newest date. What is the easiest way to get a visual only to show data from the most recent date.

 

As I see it there are multiple ways – a measure, filter(although this does not work for me), row count in the source.

 

I have a simple example – data set:

Date                  |type        |value|

20-06-2018          A             20

20-06-2018          B             40

19-06-2018          A             21

19-06-2018          B             39

 

And my table visual should then only show:

Date                 |type         |value|

20-06-2018          A             20

20-06-2018          B             40

 

Many thanks

\Chr


Accepted Solutions
Highlighted
Community Support Team
Posts: 7,292
Registered: ‎05-02-2017

Re: Show only data from the latest date

Hi @ChristianTD,

 

Seems date type values don't have a "TOP" filter type. I would suggest you try the measure below and add it to the "Visual Level filter". Don't need to add it to any visual. Then filter the filter as "1". Please give it a try.

Measure =
VAR LatestDate =
    CALCULATE ( MAX ( 'Table1'[Date] ), ALL ( 'table1' ) )
RETURN
    IF ( MIN ( 'Table1'[Date] ) = LatestDate, 1, 0 )

Best Regards,

Dale

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

View solution in original post


All Replies
Super User
Posts: 2,618
Registered: ‎11-29-2015

Re: Show only data from the latest date

One way is to add this calculated column to your table, which returns a 1 or 0 for latest/not latest which you can use as a filter

 

Is Latest Row Filter = 
VAR LatestDate = MAXX(FILTER('Table1','Table1'[Type] = EARLIER('Table1'[Type])),'Table1'[Date])
RETURN IF('Table1'[Date]=LatestDate,1,0)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Frequent Visitor
Posts: 9
Registered: ‎05-16-2018

Re: Show only data from the latest date

[ Edited ]

Thanks.

 

You would then apply a filter where this column is = 1, wouldn't you have to display this column in order for it to work?

would this be updated every time I do a refresh of data ?

Super User
Posts: 2,618
Registered: ‎11-29-2015

Re: Show only data from the latest date

Correct. Just add it as a filter on your visual ser to 1

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Frequent Visitor
Posts: 9
Registered: ‎05-16-2018

Re: Show only data from the latest date

I would like not to show the new column.

I also tried with a measure Latest = LOOKUPVALUE(Table[Date];Table[Date];MAX(Table[Date])) and then adding my date to the filter and add top 1 by Latest.

 

Alternatively wouldn't just a simple filter work.. date top 1 by date?

Highlighted
Community Support Team
Posts: 7,292
Registered: ‎05-02-2017

Re: Show only data from the latest date

Hi @ChristianTD,

 

Seems date type values don't have a "TOP" filter type. I would suggest you try the measure below and add it to the "Visual Level filter". Don't need to add it to any visual. Then filter the filter as "1". Please give it a try.

Measure =
VAR LatestDate =
    CALCULATE ( MAX ( 'Table1'[Date] ), ALL ( 'table1' ) )
RETURN
    IF ( MIN ( 'Table1'[Date] ) = LatestDate, 1, 0 )

Best Regards,

Dale

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