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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Roy_W
Frequent Visitor

Wrong result when fill down with Lastnonblank dax

Hi all,

I meet the issue when deal the data with some date and milestone information.

First, I build two tables, one is the Calendar table, the other is about some date of milestone.

#Milestone table:

Roy_W_0-1629642755929.png

Then, I build relationship between the tables, and I need to fill down the milestone value to the Calendar table.

The dax formula as below:

rev_Milestone =
IF (
'Calendar'[Milestone] = "",
CALCULATE (
LASTNONBLANK('Calendar'[Milestone], 'Calendar'[Milestone]),
FILTER (
'Calendar',
'Calendar'[Date] < EARLIER('Calendar'[Date])
)
),
'Calendar'[Milestone]
)
 
The result shows wrong with m3 to finish:
Roy_W_1-1629642847936.png

I don't know why the formula goes wrong, please helps to figure out.

Another request for the formula is to stop fill down milestone value when detect "finish".

I have attached the file, thanks.

Sample File 

1 ACCEPTED SOLUTION

@Roy_W 

Column = 
    VAR __Date = [Date]
    VAR __Max = MAXX(FILTER('Calendar',[Date]<=__Date && NOT(ISBLANK([Milestone]))),[Date])
    VAR __Milestone = MAXX(FILTER('Calendar',[Date]=__Max),[Milestone])
RETURN
    IF(__Milestone <> "finish",__Milestone,IF(__Max = __Date,__Milestone,BLANK()))

TI = bad.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Fowmy
Super User
Super User

@Roy_W 


Can you check the attached file?


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Roy_W
Frequent Visitor

@Fowmy 
The result is not expected, I need the milestone change to next one,

The value under finish should be "finish" to the end, not "m3".

Roy_W_0-1629645746402.png

 

And another requirement is to stop fill down milestone value when detect "finish".

 

Thanks

@Roy_W 

Column = 
    VAR __Date = [Date]
    VAR __Max = MAXX(FILTER('Calendar',[Date]<=__Date && NOT(ISBLANK([Milestone]))),[Date])
    VAR __Milestone = MAXX(FILTER('Calendar',[Date]=__Max),[Milestone])
RETURN
    IF(__Milestone <> "finish",__Milestone,IF(__Max = __Date,__Milestone,BLANK()))

TI = bad.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

Thanks, issue solved 🙂

 

Greg_Deckler
Community Champion
Community Champion

@Roy_W You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000
Specifically: To **bleep** With FIRSTNONBLANK - Microsoft Power BI Community


These are based on this article:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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