Forum Discussion

alejopiero's avatar
alejopiero
Frequent Visitor
6 years ago
Solved

Date filter doesn't work in Calculate function

Hello, 

 

I am involved in a simple problem and I am not able to solve that.

I need the SUM function would be filtered by a measure that contains a date, but It doesn't work.

 

The function is:

 

Bags YoY = CALCULATE(sum('Sales & Returns'[(*) Sale quantity (bags)]),filter('Sales & Returns','Sales & Returns'[(*) Sales order date (adjusted)]<=[LastOrderDatePY]))

 

 

The measure that is the filter takes the last date of other data set and It works right. 

 

LastOrderDatePY = LASTDATE('Sales orders'[(*) Sales order date])

 

 

The result of the function is blank, but If I change the main replacing the measure by the date function, It works fine:

 

Bags YoY = CALCULATE(sum('Sales & Returns'[(*) Sale quantity (bags)]),filter('Sales & Returns','Sales & Returns'[(*) Sales order date (adjusted)]<=DATE(2019,10,10))

 

 

But I need that the date would be updated dynamically taking the last date of the other table.

 

I am checked that the date format of all columns and measure involved in that have the same date format and they are right.

 

Could you give me a hand please?.


Thanks in advance.

Alejo

 

 

 

 

4 Replies