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
wmf_07
Frequent Visitor

Obtain the last non blank selling price and cost price of the last transaction date

I need to the latest / most recent non blank selling price and cost price as per customer and item name.
I had used this calculation for a calculated column as suggested

RECENT DATE = IF(CALCULATE(MAX(Table1[Date_]),ALLEXCEPT(Table1,Table1[Item Name],Table1[Customer Name]))=Table1[Date_],"Y")

This formula works and I was able to filter by dept.
But i require the last non-blank value of the selling price and another issue with this formula is that if there are 3 transactions done for that day it sums the selling price of all 3 transactions rather than giving me a single amount.

For eg. the most recent transaction of bbq sauce (in the given data) is on 10/4/23 but selling price is blank so i require the last time selling price was not blank for bbq sauce by customer and item.


I have uploaded the data and the desired result.

https://docs.google.com/spreadsheets/d/1vaM-SyZSevNx5oUkvk3xwivwB-J_KuPZ/edit?rtpof=true&sd=true#gid...

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@wmf_07 

Create the following two measures instead of columns:

SalesRate = LASTNONBLANKVALUE( Table06[Date_] , CALCULATE( MAX( Table06[Sales Rate] ) ) )
UnitCost = LASTNONBLANKVALUE( Table06[Date_] , CALCULATE( MAX( Table06[Unit Cost] ) ) )


Result:

Fowmy_0-1705130871207.png

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Fowmy
Super User
Super User

@wmf_07 

Create the following two measures instead of columns:

SalesRate = LASTNONBLANKVALUE( Table06[Date_] , CALCULATE( MAX( Table06[Sales Rate] ) ) )
UnitCost = LASTNONBLANKVALUE( Table06[Date_] , CALCULATE( MAX( Table06[Unit Cost] ) ) )


Result:

Fowmy_0-1705130871207.png

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

wmf_07
Frequent Visitor

Thank you 👍

@wmf_07 
You are welcome!
Kinldy accept the soulution for the same question here as well: Obtain the last non blank selling price and cost p... - Microsoft Fabric Community



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.