Forum Discussion

Trist's avatar
Trist
Frequent Visitor
5 years ago

Date add issue

Hi Everybody,

ı have an ıssue about date . ı am tryıng to calculate order sales for respective dates. such as below;

productıdtotal sales-01.01.2021total sales-01.02.2021total sales-01.03.2021
110010005000
22001502000
33004503000
48008004500

ı have an date filter which is equal to 'Dim_Date'[date] . when ı select 01.01.2021 as date filter, ı want to see to 01.02.2021, 01.03.2021 respectively in fields. so when ı try to add one month to measure ı fail. could you help please? 

measure:

TotalSales = CALCULATE(
SUM('order'[sales])
,FILTER('Dim_Date'[date] <= ['sales'[date]))

 

note: ı tryed datediff and dateadd but ıt doesnt work ı dont know why.

3 Replies

  • is your table structure same as shown above?

     

    I think it would be best if we have table structure as below

     

    Product Id    Date    Sales

    1                01.01.2021 100

    1                01.02.2021  200

    1                01.03.2021  500

     

    then you can make connection with date table and have filtering like you wanted.

     

    Does this make sense?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Trist 

     

    Before you start doing anything in PBI and DAX, you should read THIS. Your data is in a wrong shape for analysis in a tabular model.

  • v-xulin-mstf's avatar
    v-xulin-mstf
    Community Support

    Hi Trist,

     

    Could you provide your pbix file after removing sensitive information?

    Maybe you can change data structure in query editor and the apply the measure.

     

    Best Regard,

    Link