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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
MAP
Frequent Visitor

undefined

How to get only last Friday closing rate of a stock dynamically in power bi dax 

5 REPLIES 5
MAP
Frequent Visitor

Thanx for your solution , It works fine, but I have a date slicer in my report page which  do not effect my last friday closing rate, In other words I always get last friday closing rate irrespective of date selection

@MAP 

Explain your requirements a bit more clarly and provide mode details on how your data model is organized.
Better, you could attach a sample PBIX file using a OneDrive or GoogleDrive.


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Fowmy
Super User
Super User

@MAP 

Try:

Last Friday Rate = 
VAR __LastFriday = MAXX( FILTER( VALUES( Stocks[Date] ) , WEEKDAY( Stocks[Date]  ,1 ) = 6 ) , Stocks[Date] )
VAR __Result = CALCULATE( MAX(Stocks[Closing Rate]) , Stocks[Date] = __LastFriday )
RETURN
   __Result
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

MAP
Frequent Visitor

Thanx for your solution. It works fine but I have a date slicer on my report page ,whatever date I will select from the date slicer your solution won't take changes according to selected date ,in other words slicer don't effect this measure and give me last friday closing rate dynamically. You got it my point.....! 

rohit1991
Super User
Super User

Hi @MAP ,

You can do this with a measure that always gets the last available Friday’s closing rate, no matter what’s selected in your slicer. Try this: 

Last Friday Closing Rate =
VAR LastFriday =
    CALCULATE(
        MAX(Stocks[Date]),
        FILTER(
            ALL(Stocks),
            WEEKDAY(Stocks[Date], 2) = 5
        )
    )
RETURN
    CALCULATE(
        MAX(Stocks[Closing Rate]),
        FILTER(
            ALL(Stocks),
            Stocks[Date] = LastFriday
        )
    )

 

This measure ignores any date filter or slicer and always finds the most recent Friday in your dataset, then pulls the closing rate for that date. If there’s a missing Friday (holiday, etc), it’ll just grab the latest one that exists. If you have multiple stocks and want the last Friday closing for each one, you can wrap the logic in an additional filter by ticker. 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.