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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
RobRayborn
Helper IV
Helper IV

Incorrect Totals with Lastnonblank

I'm not getting a correct grand total for my Units when using LASTNONBLANK.

I have expression: 

CUST FORECAST QTY = SUMX('FC Combined', 'FC Combined'[QTY])

Some of my customers buy the same part but don't give me a forecast on the same date 'OEM FC Combined'[Date Created]'.

I have found that with the measure below I get the amount for each GROUP for the last OEM FC Combined'[Date Created], but my total only gives me the amount from the OEM FC Combined'[Date Created] of any of the GROUPs showing that take that Part.

 

CUST. FC QTY = CALCULATE([CUST FORECAST QTY],LASTNONBLANK('OEM FC Combined'[Date Created], [CUST FORECAST QTY]))
How do I get a correct Total? 

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @RobRayborn 

It is normal that the value calculated by Totals in measures is not the sum of all the above rows. Because the measurement value is calculated in the filter context, your filter context in Total is different from the filter context of each row above, so the result may not be the total.

If you want to correct the value of Total, you can create a new metric based on your metric, and you can use functions such as Values() to build a new context; then use the SUMX() function to return the corresponding filter context The sum of the measured values.

For this , you can refer to :
Fixing Incorrect Totals Using DAX Measures In Power BI | Enterprise DNA

What to Do When Power BI Totals are Wrong – business intelligist

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
v-yueyunzh-msft
Community Support
Community Support

Hi , @RobRayborn 

It is normal that the value calculated by Totals in measures is not the sum of all the above rows. Because the measurement value is calculated in the filter context, your filter context in Total is different from the filter context of each row above, so the result may not be the total.

If you want to correct the value of Total, you can create a new metric based on your metric, and you can use functions such as Values() to build a new context; then use the SUMX() function to return the corresponding filter context The sum of the measured values.

For this , you can refer to :
Fixing Incorrect Totals Using DAX Measures In Power BI | Enterprise DNA

What to Do When Power BI Totals are Wrong – business intelligist

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

RobRayborn
Helper IV
Helper IV

I almost forgot, I am using Month Year from my Date table for the columns and GROUP--> Part in Rows.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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