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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.