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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Super User
Super User

@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!:
Power BI Cookbook Third Edition (Color)

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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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