Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
KLJ
Helper I
Helper I

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

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


Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
ImkeF
Super User
Super User

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

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


Regards
Zubair

Please try my custom visuals

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.