Forum Discussion

CNENFRNL's avatar
CNENFRNL
Icon for Community Champion rankCommunity Champion
5 years ago
Solved

Issue about CALCULATETABLE

Dear gurus, I came across an issue which I can't wrap my head around; so I turn to you for help. Thnx in advance! The senario is fairly simple, which involves only one simple table of dates. I use ...
  • Fowmy's avatar
    5 years ago

    CNENFRNL 

    Yes, CALCULATETABLE creates a context transition but FILTER doesn't.  In your case, if you look at the arguments in CALCULATETABLE, after you have applied 'Calendar'[Date] >= __date, you remove filters using ALL ( 'Calendar'[Date] ), that is the reason all dates are in the result. But if you apply VALUES to respect the filters then you can get the correct results with the same formula.

    Corrected = 
    VAR __date = MAX ( 'Calendar'[Date] )
    RETURN
        CONCATENATEX (
            CALCULATETABLE ( VALUES('Calendar'[Date] ), 'Calendar'[Date] > __date ),
            'Calendar'[Date],
            UNICHAR ( 10 )
        )

    ________________________

    If my answer was helpful, please consider Accept it as the solution to help the other members find it

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube  LinkedIn