Return Date fulfilling Criteria

monsoonnut

New Member
Joined
Jul 1, 2016
Messages
13
Hi

I am stumped on how to construct a measure that will return a YearWeek value dependent on 'another' measure.

The 'other' measure is 'Projected Closing Stock': '(current stock + cumulative orderbook(future)) - cumulative forecast(future)' which is calculated at weekly (not daily) level. I am trying to return the week where the projected closing stock falls below zero.

I have a custom dates table (daily level) which is marked as a dates table in the model.

I'm thinking FIRSTDATE is the way to go but can't get it to work in the expected, or any way really.
C:\Users\tynanm\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png


Any ideas, suggestions appreciated.

Thanks

M
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
I Worked it out, GFITW Strikes again!

Projected Week OOS:=CALCULATE(Min(DimDate[YearWeek]),ALL(DimDate),FILTER(ALL(DimDate),'Key Line OS Orders'[Total Projected Closing Stock]<=0))

M
 
Upvote 0
Cool you solved the problem. One small note though. The second parameter to CALCULATE - ALL(DimDate) - is redundant and not necessary and can be removed from the formula.
 
Upvote 0
Please correct me if I am wrong but it appears his formula dos not work

DAX does not allow to build table[column] expression inside FILTER expression (below marked in bold). You would need to mix it with VALUES() to bring in column "Total Projected Closing Stock"

Projected Week OOS :=
CALCULATE (
MIN ( DimDate[YearWeek] ),
FILTER (
ALL ( DimDate ),
'Key Line OS Orders'[Total Projected Closing Stock] <= 0
)
)
 
Last edited:
Upvote 0
Please correct me if I am wrong but it appears his formula dos not work

DAX does not allow to build table[column] expression inside FILTER expression (below marked in bold). You would need to mix it with VALUES() to bring in column "Total Projected Closing Stock"

table[column] is allowed as long as 'table' is the same table as the first parameter in filter. In is case, I am guessing this part of the filter formula is actually a measure. Best practice is to not specify the table name of a measure to avoid this exact confusion.
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,823
Members
449,470
Latest member
Subhash Chand

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top