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

  1.  Add DayOfWeek Column: DayOfWeek = WEEKDAY(Date[Date], 2) // 5 = Friday
  2. Find Last Friday: LastFriday =
    CALCULATE(
    MAX('Date'[Date]),
    FILTER('Date', 'Date'[DayOfWeek] = 5 && 'Date'[Date] <= MAX('Date'[Date]))
    )

  3. Get Closing Rate: LastFridayClosingRate =
    CALCULATE(
    SUM(StockData[ClosingRate]),
    StockData[Date] = [LastFriday]
    )
    This will dynamically return the last Friday's closing rate.

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.