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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register 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
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.