Forum Discussion
Running totals between to dates
- 4 years ago
Hi _chris_
Try this measure instead. It doesn't care whether there is a relationship between both tables because it uses ALL to remove all filters in the context before comparing dates.
Open Amount = SUMX ( FILTER ( ALL ( 'Table' ), 'Table'[Date] <= MAX ( 'Date'[Date] ) && 'Table'[CloseDate] > MAX ( 'Date'[Date] ) ), 'Table'[Amount] ) + 0Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi _chris_
Please create the following measure in your model.
Open Amount =
CALCULATE (
SUM ( 'Table'[Amount] ),
ALL ( 'Table' ),
'Table'[Date] <= MAX ( 'Date'[Date] ),
'Table'[CloseDate] > MAX ( 'Date'[Date] )
) + 0
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Thank you very much, unfortunately I am getting an error:
A function of type 'MAX' has been used in a TRUE/FALSE expression which serves as a Table filter expression. This is not allowed.
One more information here: I am not having a relationship between both tables. Is this correct?
- v-jingzhang4 years ago
Community Support
Hi _chris_
Try this measure instead. It doesn't care whether there is a relationship between both tables because it uses ALL to remove all filters in the context before comparing dates.
Open Amount = SUMX ( FILTER ( ALL ( 'Table' ), 'Table'[Date] <= MAX ( 'Date'[Date] ) && 'Table'[CloseDate] > MAX ( 'Date'[Date] ) ), 'Table'[Amount] ) + 0Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.- _chris_4 years ago
Helper III
Hi jingzhang,
now it works perfectly. Thank you very much!
The "old" measure I got running with a small file still yesterday evening (not my "big" model). However, I wanted to do something like IF(ISBLANK(Table[CloseDate]), DATE(2100, 12, 31), Table[CloseDate])) as offers which are not having a close date also should be included. This did not work with the first measure. But now also this works perfectly fine.
Thx again!
Christian