Forum Discussion

v_rome's avatar
v_rome
Frequent Visitor
4 years ago
Solved

How to return a Tableobject using IF DAX-Function

Hello I'm trying to get a Tableobject back from an IF-Function, to use it in a Slicer Visual. I have created a DateTable with one Column of Dates. Now I want to get only specifiy Date Ranges based o...
  • AlexisOlson's avatar
    AlexisOlson
    4 years ago

    Yep. IF won't return tables, unfortunately.

     

    v_rome Here's one way to work around that limitation for your specific case:

    Check1 =
    VAR lastDayOfMonth = EOMONTH ( TODAY (), 0 )
    VAR shift = IF ( lastDayOfMonth - 7 <= TODAY (), 0, -1 )
    VAR filter1 =
        DATESINPERIOD ( DateTable[Date], EOMONTH ( TODAY (), shift ), -1, YEAR )
    RETURN
        filter1