Forum Discussion

danb's avatar
danb
Icon for Resolver I rankResolver I
7 years ago
Solved

Combining Volumes into table with date ranges

Afternoon experts!    I am stumped. I have two tables, one that has pricing for different items by location and date range. The second table has the sales numbers by date / location. I would like t...
  • MFelix's avatar
    7 years ago

    Hi danb ,

     

    You can add a measure or a column depending on your setup check formulas below:

     

    Measure =
    CALCULATE (
        SUM ( Volume[Quantity] );
        FILTER (
            ALL ( Volume[Item]; Volume[Location]; Volume[Quantity]; Volume[Sales Date] );
            MAX ( Pricing[Item] ) = Volume[Item]
                && MAX ( Pricing[Location] ) = Volume[Location]
                && Volume[Sales Date] >= MAX ( Pricing[Price Start Date] )
                && Volume[Sales Date] <= MAX ( Pricing[Price End Date] )
        )
    ) + 0
    
    
    Column =
    CALCULATE (
        SUM ( Volume[Quantity] );
        FILTER (
            ALL ( Volume[Item]; Volume[Location]; Volume[Quantity]; Volume[Sales Date] );
            Pricing[Item] = Volume[Item]
                && Pricing[Location] = Volume[Location]
                && Volume[Sales Date] >= Pricing[Price Start Date]
                && Volume[Sales Date] <= Pricing[Price End Date]
        )
    )
    

    Regards,

    MFelix