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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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