Forum Discussion

leo's avatar
leo
Frequent Visitor
9 years ago
Solved

Holiday Item Sales with variable date range

I am gaining speed with Power Bi, DAX, and M but this problem is well beyond my abilities.    The business sells specific items that are related to a holilday.  Each holiday has a specific date ran...
  • v-ljerr-msft's avatar
    9 years ago

    Hi leo,

     

    If I understand you correctly, you should be able to use the formula below to create a new measure to calculate the sales filtered by the holiday date range and the items for that holiday.

    Total Sales =
    CALCULATE (
        SUM ( Sales[SalesAmount] ),
        FILTER (
            ALL ( Sales ),
            (
                Sales[Date] >= MAX ( Holidays[HolidayBeginDate] )
                    && Sales[Date] <= MAX ( Holidays[HolidayEndDate] )
            )
                && CONTAINS ( VALUES ( Items ), Items[ItemCode], Sales[ItemCode] )
        )
    )
    

    Then you can show this measure with item category (or item) on a chart/table visual in this scenario. :smileyhappy:

     

    Regards