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
pras_hant10
Frequent Visitor

Need previous values if current values is 0, it should check until it find value.

Issue:

DAX should check until previous value is 0 (In Value), once its value is not 0 it gives me the date  (Result Needed) as below.

DAX.jpg

3 ACCEPTED SOLUTIONS
az38
Community Champion
Community Champion

Hi @pras_hant10 

try a measure

Result =
var _curDate = MAX(Table[Date])
RETURN
CALCULATE(MAX(Table[Date]); FILTER(ALL(Table); Table[Date] <= _curDate && Table[InValue] <> 0))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

az38
Community Champion
Community Champion

@pras_hant10 

almost the same

Result =
var _curDate = Table[Date]
RETURN
CALCULATE(MAX(Table[Date]); FILTER(ALL(Table); Table[Date] <= _curDate && Table[InValue] <> 0))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

Syndicate_Admin
Administrator
Administrator

Hi @pras_hant10

dealing with a measure

Result =
var _curDate = MAX(Table[Date])
RETURN
CALCULATE(MAX(Table[Date]); FILTER(ALL(Table); Table[Date] <= _curDate && Table[InValue] <> 0))

View solution in original post

8 REPLIES 8
Syndicate_Admin
Administrator
Administrator

Hi @pras_hant10

dealing with a measure

Result =
var _curDate = MAX(Table[Date])
RETURN
CALCULATE(MAX(Table[Date]); FILTER(ALL(Table); Table[Date] <= _curDate && Table[InValue] <> 0))
amitchandak
Super User
Super User

@pras_hant10 , Try like

if(Table[Invalue]=0,maxx(filter(Table, table[Date]<earlier(Table[Date])),Table[Date]),Table[Date])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I tried the same, but bellow result I am getting.

Result should be 01/02/2020 from row 2nd till last, as there is 0 In value.

DAX.jpg

@pras_hant10 ,

Try

if(Table[Invalue]=0,maxx(filter(Table, table[Date]<earlier(Table[Date]) && Table[Invalue]=0),Table[Date]),Table[Date])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
az38
Community Champion
Community Champion

Hi @pras_hant10 

try a measure

Result =
var _curDate = MAX(Table[Date])
RETURN
CALCULATE(MAX(Table[Date]); FILTER(ALL(Table); Table[Date] <= _curDate && Table[InValue] <> 0))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Thanks for your help, by my apologies, I am looking the logic for Column field.

az38
Community Champion
Community Champion

@pras_hant10 

almost the same

Result =
var _curDate = Table[Date]
RETURN
CALCULATE(MAX(Table[Date]); FILTER(ALL(Table); Table[Date] <= _curDate && Table[InValue] <> 0))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Thank you. it work 

 

DAX.jpg

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors