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
Anonymous
Not applicable

Report Filter Context Issue

I hope someone can help. I have table of invoice records. I want to create measurement that will calculate the total Shipping Amount for the most recent invoice. The below measurement works as expect however the calculation only applies if the most recent invoice date is included in the report filter. For example, my current results shows the following. How do I get the $1000 value to appear on both records?

 

    Customer         Invoice Date  ShippingCharge_Current

               XYZ              11/11/21                    blank

                                    11/12/21                   $1000

ShippingCharge_Current =

Var LastInvoiceDate = CALCULATE(MAX('Invoice'[InvoiceDate]),ALLEXCEPT(‘Invoice’ )[Customer]),ALL(Calendar), ‘Invoice'[Shipping]<0

 

Var LastInvoiceNum= CALCULATE(Max('Invoice'[Invoice Number]),AllExcept('Invoice',[Customer]),ALL(Calendar),'Invoice'[InvoiceDate] =LastInvoice)

 

Return CALCULATE('Invoice'[Shipping_Measurement],ALL(Calendar),AllExcept('Invoice',[Customer]),FILTER('Invoice','Invoice'[InvoiceNumber]= LastInvoiceNum))

 

  

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous , Try like

calculate(lastnonblankvalue(Invoice[Invoice Date], sum(Invoice[Shipping_Measurement])), allexpect(Invoice, Invoice[Customer]))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

The suggestion did not work. I need the current shipping charge to appear on all invoice records. 

Anonymous
Not applicable

How do I incorporate this in my current code?

@Anonymous , as a new measure

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Can you provide more direction. I need a single value measurement. Not a table.

Thanks

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.