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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
srikanth571
Frequent Visitor

how to get date whenever there is a demand considering for next 4 weeks.

 

Hello all,

 

I need to get the date whenever there is a demand considering for next 4 weeks combined for metrics- Intransit,backorder,pastdue and pastship. If there is any demand in any of these metrics then i need to show that date.

 

ex: considering current 4 weeks 11-09-2023,18-09-2023,25-09-2023,02-10-2023

for 11-09-2023 there is no demand which is 0 for all the 4 metrics then look for 18-09-2023

I see demand 3000 only in the 18-09-2023, then i need to have week 18-09-2023 as my result.

similarly if i see demand in any future week in the 4 week window then I need to return that date as my result.

 

any dax for the above issue will be helpful.

 

below is the example:

srikanth571_0-1695383693518.png

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

This DAX measure pattern should work

Total sales = sum(Data[sales])

Measure = calculate(min(Data[Date]),calculatetable(firstnonblank(calendar[date],calculate([Total sales])),datesbetween(calendar[date],max(calendar[date]),max(calendar[date])+21))

If it does not help, then share the download link of the PBI file.  Clearly show the expected result there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

This DAX measure pattern should work

Total sales = sum(Data[sales])

Measure = calculate(min(Data[Date]),calculatetable(firstnonblank(calendar[date],calculate([Total sales])),datesbetween(calendar[date],max(calendar[date]),max(calendar[date])+21))

If it does not help, then share the download link of the PBI file.  Clearly show the expected result there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

logic what you provided worked perfectly with my request with few additional changes i have done. Thank you again for your help. 

lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.