cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors