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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
RZ89
Frequent Visitor

Get Date from first negative Value of running stock

Hi everyone,

 

I have set up a running stock report to see at which time the stock is used up.

For that I am using a matrix visual and 2 DAX measures.

 

I need a custom DAX measure that gives back the date value for reaching the first negative running stock value for a material.

In This example it will be the 17.11 for Material 15M7068

Unfortunately I am not yet able to set this up..

 

Thanks for helping me! Best regards Ralph

 

Seq =
MINX (
FILTER (
SELECTCOLUMNS (
FILTER(ALLSELECTED(CA_MD04_ALL_REQUIREMENT_999_Tage),CA_MD04_ALL_REQUIREMENT_999_Tage[Material]=MAX(CA_MD04_ALL_REQUIREMENT_999_Tage[Material])),
"index", CA_MD04_ALL_REQUIREMENT_999_Tage[Req Date],
"rank", RANKX ( ALLSELECTED ( CA_MD04_ALL_REQUIREMENT_999_Tage ), CA_MD04_ALL_REQUIREMENT_999_Tage[Req Date],,ASC, DENSE )
),
[index] = MAX ( CA_MD04_ALL_REQUIREMENT_999_Tage[Req Date] )
),
[rank]
)
 
_____________________________________
 
Running_Stock = [Stock Value] - SUMX(TOPN( [Seq]
,FILTER(ALLSELECTED(CA_MD04_ALL_REQUIREMENT_999_Tage),CA_MD04_ALL_REQUIREMENT_999_Tage[Material]=MAX(CA_MD04_ALL_REQUIREMENT_999_Tage[Material]))
,CA_MD04_ALL_REQUIREMENT_999_Tage[Req Date],ASC)
,CALCULATE(SUM(CA_MD04_ALL_REQUIREMENT_999_Tage[Open Qty]))
)
 
__________________________
 
RZ89_0-1668590341602.png

 

2 REPLIES 2
johnt75
Super User
Super User

You can try

First negative date =
FIRSTNONBLANK ( 'Date'[Date], IF ( [Running Stock] < 0, 1 ) )
RZ89
Frequent Visitor

Hi,

 

thank for the hint.

I set up that Dax measure, but I cannot drop it into my row of the matrix visual..

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.