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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
lync0056
Helper I
Helper I

Last Sale Amount- LASTNONBLANK()

Hi, 

 

I'm trying to calculate the last Sale Amount in a Sales Table. (See screenshot of my model below) My measure is as follows;

 

Last Sale Amount = CALCULATE( [Total Sales] , LASTNONBLANK( Dates[Date] , [Total Sales] ) )

 

 

The moment I make the Date and Invoice tables bi-directional it works. But then breaks alot of my other measures with below screenshot errors. 

 

Any help would be great.

 

Thank you


Cameron

 

Screen Shot Data Model.pngScreen Shot Error.png

1 ACCEPTED SOLUTION

I received the solution to this on a different forum. Pasted below.

 

Last Sales Amount  =
VAR LastSalesDate = MAX( Invoices[Date] )

RETURN
CALCULATE( [Total Sales] ,
FILTER( ALL( Dates ),
Dates[Date] = LastSalesDate ))

View solution in original post

3 REPLIES 3
v-jianhe-msft
Resolver II
Resolver II

Hi,

 

What is the relationship between Sales table and Invoice table? If you set it a single cross filter, how is the result? 

It is not possible to create a direct relationship between the Invoices table and Sales Table. Indirectly there is a pointer from Sales to Journals and then Journals to Invoices. 

 

I received the solution to this on a different forum. Pasted below.

 

Last Sales Amount  =
VAR LastSalesDate = MAX( Invoices[Date] )

RETURN
CALCULATE( [Total Sales] ,
FILTER( ALL( Dates ),
Dates[Date] = LastSalesDate ))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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