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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
s_kula
Helper I
Helper I

dax function

Hello, I need to write a formula in dax that will calculate a date from a list of dates from a table. The formulas are supposed to take into account the product id filter:
1. the first function is to calculate the maximum date, maximum -1, maximum -2 so that I can choose the appropriate string value
2. the second function is to return a specific value from the row with the calculated date and product id, e.g. quantity.

Regards
Sebastian

3 REPLIES 3
s_kula
Helper I
Helper I

I guess I failed to check I have a list of dates.
In this list, the maximum date is 24/04/2023.
However, I want to be able to calculate the next e.g.
22/04/2023 (max-1) and another 17/04/2023 (max-2), i.e. subsequent dates in a decreasing sequence. The function must include a filter for a specific product id.

At the same time, the result of this function is supposed to be a filter to find other values ​​from a table row.
e.g.
date 22/04.2023 for product id 25, is to be a filter to the sales quantity for a given date and product id.

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Anonymous
Not applicable

Hi @s_kula ,

Very sorry, due to my unintelligence hope you can provide more information.

Why are -1 and -2 both maximum?How many tables are there in the calculations?Could you please provide more details?

 

How to Get Your Question Answered Quickly 

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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