Forum Discussion

Mike91's avatar
Mike91
Helper I
1 year ago
Solved

calculate value between 2 date

Hi All,   it's possibile calulate the sales between 2 dates? to be clear in my sales table have a column with promotion active during the period for each sku. i need calculate the sales 4 week befo...
  • dharmendars007's avatar
    1 year ago

    Hello Mike91 , 

     

    Firstly you need to setup the Calendar Table for getting the result you are for to start with you can try the below meaures and replace it with the Concern tables and columns whoch you..

     

    If you already have the promotion period selected via a slicer, you can calculate the sales during the promotion using the datesbetween like below

     

    SalesDuringPromotion =
    CALCULATE(
    SUM(Sales[SalesAmount]),
    DATESBETWEEN(
    'Calendar'[Date],MIN('Sales'[PromotionStartDate]),MAX('Sales'[PromotionEndDate])))

     

    You can calculate sales for the 4 weeks before the promotion with the Dateadd function..

     

    SalesBeforePromotion =
    CALCULATE(
    SUM(Sales[SalesAmount]),
    DATESBETWEEN(
    'Calendar'[Date],DATEADD(MIN('Sales'[PromotionStartDate]), -28, DAY),MIN('Sales'[PromotionStartDate]) - 1))

     

    If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!

     

    Thank You

    Dharmendar S

    LinkedIN