cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Take the lastest entry per week

Hi

 

I need help to take the latest entry per week form a table so I can use it in a line chart.

 

My table look like this and it updates two times per day

Udklip.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

What I need is for week 45 it gives me the data from index 2, for week 46 the data from index 6 and for week 47 the data from index 10 and so on as the table grows. Allways the latest entry for each week.

 

Hope you can help me.

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Take the lastest entry per week

HI @KLJ

 

See the attached file.

 

This is one simple way of doing this

 

Add a Calculated Column which will RANK days for each Week.

Then you slice the Entire Table with RANK 1

 

Rank_by_Date =
RANKX (
    FILTER ( TableName, TableName[Week] = EARLIER ( TableName[Week] ) ),
    TableName[Load Date],
    ,
    DESC,
    DENSE
)

Photo8.png

Try my new Power BI game Cross the River

View solution in original post

3 REPLIES 3
Highlighted
Super User IV
Super User IV

Re: Take the lastest entry per week

if you have a Calendar-table in your model, you can create a measure with LASTDATE like described here: http://tinylizard.com/dax-lastdate-function/ and add the week-column to your report.

 

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Highlighted
Super User III
Super User III

Re: Take the lastest entry per week

HI @KLJ

 

See the attached file.

 

This is one simple way of doing this

 

Add a Calculated Column which will RANK days for each Week.

Then you slice the Entire Table with RANK 1

 

Rank_by_Date =
RANKX (
    FILTER ( TableName, TableName[Week] = EARLIER ( TableName[Week] ) ),
    TableName[Load Date],
    ,
    DESC,
    DENSE
)

Photo8.png

Try my new Power BI game Cross the River

View solution in original post

Highlighted
Frequent Visitor

Re: Take the lastest entry per week

Hi @Zubair_Muhammad

 

Thank you. That did it.

 

@ImkeF

 

Thank you for the link. yet another source of educational information on Power BI.

 

Best regards Kim

Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Kudoed Authors