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
dusdau
Helper II
Helper II

Calculating sales since price expiration date

Hi All,

 

I did some searching and couldn't come up with what I needed to solve my problem.  Basically I am trying to calculate Sales since the price on the part expired.  Considering these 3 tables and relationships.

 

Date Table (one to many with Sales Table)

Columns: Date, etc.

 

Part Table (one to many with Sales Table)

Part, Price Expiration Date, Days since expiration, etc.

 

Sales Table (Transactions)

Transaction Date, Amount, etc.

 

I want to CALCULATE the Sales[Amount] for the Part since the Price Expiration Date on the part.

 

Seems like I should be able to do this with DAX but I can't quite figure out how to filter the sales by the variable/dynamic price expiration date.

Any ideas? Thanks!

2 ACCEPTED SOLUTIONS
VijayP
Super User
Super User

@dusdau 

Use this file for Solution and let me know if you are good with it! Will explain if you are not clear about the measures! Let me know!




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


View solution in original post

Nice @VijayP !  I think you can do it with out adding the [Price Expired Date] to the sales table as well.

Sales of Expired Items = 
CALCULATE (
    [Total Sales],
    FILTER (
        Sales,
        RELATED ( Dates[Date] ) > RELATED ( Parts[Price Expired Date] )
    )
)

View solution in original post

4 REPLIES 4
dusdau
Helper II
Helper II

Thanks @VijayP and @jdbuchanan71 !  Exactly what I needed.  It does indeed work both ways.  Thanks so much!

VijayP
Super User
Super User

@dusdau 

Use this file for Solution and let me know if you are good with it! Will explain if you are not clear about the measures! Let me know!




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Nice @VijayP !  I think you can do it with out adding the [Price Expired Date] to the sales table as well.

Sales of Expired Items = 
CALCULATE (
    [Total Sales],
    FILTER (
        Sales,
        RELATED ( Dates[Date] ) > RELATED ( Parts[Price Expired Date] )
    )
)

@jdbuchanan71 Yes you are right! I created this poc for @dusdau quickly and later realised I can use that as well!




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


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.