Forum Discussion

DataScope's avatar
DataScope
New Member
4 years ago
Solved

DAX Calculate, Sum, Datesbetween duplicate date error

I would like to calculate sales for the specific time period (1/1/2021 to 1/31/2021) but keep receiving an error. My data contains a facts table named sales_order_item. Sales_order_item has a row for...
  • v-xiaotang's avatar
    4 years ago

    Hi DataScope 

    if you already have a specific date period, there is no need to use 'Date Table'. In this scenario, you can use the second measure, it calculates total by filter 'sales_order_item' in a period 

    Promo Sales 1 = CALCULATE(SUM(sales_order_item[sale_pricel]), filter('sales_order_item', 'sales_order_item'[order_date]>= DATE(2021,01,01) && 'sales_order_item'[order_date]<= DATE(2021,01,31)))

    Here's a post for your reference on when to use a calendar table, 

    https://community.powerbi.com/t5/Desktop/Calendar-Table/m-p/1281928

     

     

    Best Regards,

    Community Support Team _Tang

    If this post helps, please consider Accept it as the solution to help the other members find it more quickly.