cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Last X values

Hello

 

Is it possible to filter a visual so that it shows the last X values, where X could be 10 as an example?

 

Lets say I have the following visual:

Capture.PNG

It currently shows the last 30 days, but I would like for it to show the last 10 observations instead.

How can I do this?

 

Thanks

1 ACCEPTED SOLUTION
amitchandak
Super User IV
Super User IV

@Anonymous , last 10 means the last 10 dates or transactions.

You can use Rank

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

4 REPLIES 4
amitchandak
Super User IV
Super User IV

@Anonymous , last 10 means the last 10 dates or transactions.

You can use Rank

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

tex628
Super User II
Super User II

To do that you will need to create a calculated column to rank the observations in order of most recent. What exactly is an observation in your scenario? 

/ J


Connect on LinkedIn
Anonymous
Not applicable

@tex628 

 

I am running a robot.

The robot performs a transaction. The time it does this is saved as "transactionStart" and is in the date and time format: 16-04-2020 08:09:30.

Once done, the transaction gets a status depending on the outcome of the run. This can either be "Successful", "App. Exception" or "Bus. Exception" as shown in the previous picture.

 

Try something like like.

 

1^(1/(MAX('Table'[TransactionStart]) - [TransactionStart]) * 1.)

 

Your top 10 numbers (TOPN filter) are the the ones to display.

 

Or, don't bother with a new column at all, just use TOPN filter on your TransactionStart column or a column with formula [TransactionStart] * 1.


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors