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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jame_moriaty
Regular Visitor

Find the last non blank value

Hi All,

I have data like below.  I use the function :

IP Land Leased Area = TOTALQTD( SUM('Industrial Park'[LAND_Leased_Land_Area]),'Calendar'[DATE])
 
IP Land Leased Area Last Value = LASTNONBLANKVALUE('Calendar'[DATE], 'Industrial Park'[IP Land Leased Area])
 
However, the function IP Land Leased Area Last Value can not calculate the total exactly. The Total = 34.573 is wrong, the Total exactly = 35.360 because the Quang Ninh Province is not calculate in the Total (the reason is the Quang Ninh Province doesnot have the value at 31-dec-2021)
pic 1.PNG

 

pic 2.PNG

 Please help me how to fix the calculate the Total = 35.360. Thank you!

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @jame_moriaty 
Please try

IP Land Leased Area Last Value =
SUMX (
    VALUES ( TableName[City] ),
    CALCULATE (
        LASTNONBLANKVALUE ( 'Calendar'[DATE], 'Industrial Park'[IP Land Leased Area] )
    )
)

View solution in original post

5 REPLIES 5
tamerj1
Super User
Super User

Hi @jame_moriaty 
Please try

IP Land Leased Area Last Value =
SUMX (
    VALUES ( TableName[City] ),
    CALCULATE (
        LASTNONBLANKVALUE ( 'Calendar'[DATE], 'Industrial Park'[IP Land Leased Area] )
    )
)

Thank you tamerj1 so much !

Greg_Deckler
Community Champion
Community Champion

@jame_moriaty This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907



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...

Dear Greg,

 I don't know how to fix this error . Can you help me ? 

@jame_moriaty Try:

IP Land Leased Area Last Value Total = 
  VAR __Table = SUMMARIZE('Table',[City],"__Value",[IP Land Leased Area Last Value])
RETURN
  IF(HASONEVALUE('Table'[City]), [IP Land Leased Area Last Value], SUMX(__Table,[__Value]))


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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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