Forum Discussion

Dave_de_Castro's avatar
Dave_de_Castro
Frequent Visitor
1 year ago
Solved

Filtering a Table for a date range that exists in two date columns

Hi There, I am fairly fresh here so please forgive me if this has been asked previously. I have a model which has a date table and a fact table with two date columns (ME_PostDate, ME_Rec_Date, not...
  • OwenAuger's avatar
    1 year ago

    Hi Dave_de_Castro 

    I would suggest a measure like this:

     

    P_PDRD_Month =
    VAR ME_Rec_Date_Filter =
        CALCULATETABLE (
            VALUES ( a_NZ_JPR[ME_Rec_Date] ),
            USERELATIONSHIP ( a_NZ_JPR[ME_Rec_Date], Date_Table[Date] )
        )
    RETURN
        CALCULATE (
            SUM ( a_NZ_JPR[J Profit NZD] ),
            -- Apply ME_Rec_Date_Filter simultaneously with filter based on active relationship.
            KEEPFILTERS ( ME_Rec_Date_Filter )
        )

     

    The idea is to create a filter on ME_Rec_Date using the inactive relationship, then combine this with the Date_Table filter combined with the active relationship.

     

    (I couldn't open the workbook as it seems to be a local link.)

     

    Does this work for you?