Forum Discussion

EnderWiggin's avatar
EnderWiggin
Icon for Helper I rankHelper I
4 years ago
Solved

Filter Calendar lookup table based on fact table value

Hi All,

I would like to ask your help to find a solution of the following case.

I would like to get the minimum Calandar[Date] value which is equal or greater than TransctionPast[FirstValid] date.

Here are the relationships:

I created the following measure but it just uses a lot of RAM without any result, when I tried to put it in it in a power pivot's value section

I think it is caused by the relationship and the filter direction but I can not figure out how to get the required date value. 

I would use it for further calcualtion which will be in the value section of a power pivot.

Could you help me to define the required measure? Please see the sample file on the following link. Thank you very much in advance!

Power Pivot Sample 

  • Anonymous's avatar
    Anonymous
    4 years ago

    EnderWiggin 

    You would not return anything if you compare Date with MIN('TransactionPast'),[FirstValid]). If you would to compare Calendar date with minimum date in [FirstValid] column.

     

    Try:

    Measure = CALCULATE(MIN('Calendar'[Date]),FILTER('Calendar',[Date]>=MINX(ALL('TransactionPast'),[FirstValid])))
     
     
    Best regards
    Paul Zheng _ Community Support Team
    If this post helps, please Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    EnderWiggin 

    You would not return anything if you compare Date with MIN('TransactionPast'),[FirstValid]). If you would to compare Calendar date with minimum date in [FirstValid] column.

     

    Try:

    Measure = CALCULATE(MIN('Calendar'[Date]),FILTER('Calendar',[Date]>=MINX(ALL('TransactionPast'),[FirstValid])))
     
     
    Best regards
    Paul Zheng _ Community Support Team
    If this post helps, please Accept it as the solution to help the other members find it more quickly.
  • Anonymous, you are right in some cases the 'TransactionPast'),[FirstValid]) value was not available becasue of the filter context, so this was the root cause of the high memory usage. Your measure works, so thank you very much  for the solution and your response!