cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ice1341
Helper I
Helper I

Need Dax formula to lookup price table with price change dates

How can integrate the price table into Power BI reports? Need to lookup invoice by shipment date to retrieve the correct price for an upcoming price increase.  

 

Ice1341_0-1627787815097.png

 

2 ACCEPTED SOLUTIONS
ebeery
Solution Supplier
Solution Supplier

@Ice1341 you've included very little of the info that would be needed to actually properly answer your question.

What is "the price table"?  Does your model have multiple tables?  Are there relationships in your model?

If there are relationships between the tables involved, the RELATED() function may work.  Otherwise, I'd take a look at using LOOKUPVALUE().

View solution in original post

yingyinr
Community Support
Community Support

Hi @Ice1341 ,

I created a sample pbix file(see attachment), please check whether that is what you want.

1. Create a calculated column as below under the table PostedSalesLine

List price from product pricing table = 
CALCULATE (
    MAX ( 'Product Price'[LIST PRICE] ),
    FILTER (
        'Product Price',
        'Product Price'[NUMBER] = 'PostedSalesLine'[NUMBER]
            && 'PostedSalesLine'[SHIPMENT DATE] >= 'Product Price'[STARTING DATE]
            && (
                'PostedSalesLine'[SHIPMENT DATE] <= 'Product Price'[ENDING DATE]
                    || 'Product Price'[ENDING DATE] = BLANK ()
            )
    )
)

yingyinr_0-1628065833165.png

Best Regards

Community Support Team _ Rena
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

6 REPLIES 6
Ice1341
Helper I
Helper I

I wanted to get the list price(PostedSalesLine.ListPrice) from the Product Pricing Table. When our price goes up in Oct. I want the list price column in PostedSalesLine table to update accordingly.
I'm sorry for the confusion, I can calculate sales with (qty * list price), but the list price isn't based on product pricing table- which has the starting/ending dates in which the product price will change.

 

Capture.JPG

 

yingyinr
Community Support
Community Support

Hi @Ice1341 ,

I created a sample pbix file(see attachment), please check whether that is what you want.

1. Create a calculated column as below under the table PostedSalesLine

List price from product pricing table = 
CALCULATE (
    MAX ( 'Product Price'[LIST PRICE] ),
    FILTER (
        'Product Price',
        'Product Price'[NUMBER] = 'PostedSalesLine'[NUMBER]
            && 'PostedSalesLine'[SHIPMENT DATE] >= 'Product Price'[STARTING DATE]
            && (
                'PostedSalesLine'[SHIPMENT DATE] <= 'Product Price'[ENDING DATE]
                    || 'Product Price'[ENDING DATE] = BLANK ()
            )
    )
)

yingyinr_0-1628065833165.png

Best Regards

Community Support Team _ Rena
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

Worked great thanks!

ebeery
Solution Supplier
Solution Supplier

@Ice1341 you've included very little of the info that would be needed to actually properly answer your question.

What is "the price table"?  Does your model have multiple tables?  Are there relationships in your model?

If there are relationships between the tables involved, the RELATED() function may work.  Otherwise, I'd take a look at using LOOKUPVALUE().

View solution in original post

Right now I'm calculating gross sales with a formula (qty * list price) joined on PostedSalesLIne table. But I want to calculate gross sales by doing a LOOKUPVALUE() using the product/list table above and PostedSalesLine table.  I also have a PostedInvoicetable where I calculate Net Sales, which the calculation will always be correct because it is derived from the invoice itself. 

 

sell to custShip dateQtyUPC NumberGross SalesProd LineList Price
WAL60477/26/202180LIN00221812sun22.65
WAL88515/1/202180LIN00221812sun22.65
WAL89409/30/2021160LIN00223624sun22.65
WAL901410/12/202180LIN00221812sun22.65
       
 PostedSalesLineTable   
yingyinr
Community Support
Community Support

Hi @Ice1341 ,

What's your expected result? Do you want to get the sales which equal to qty* list price? And the list price need to retrieve from the product/list table? If yes, there are multiple prices for per No., then which price we need to get? Could you please provide the related calculation logic? By the way, whether there is one relationship created between the field [No.] in product/list table and the field [UPC Number] in PostedSalesLineTable? Thank you.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Top Kudoed Authors