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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. 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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors