Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

how to add date range filter

Hi,

 

i have table has start date/time and end date/time filed. now i want to give date range filter to user so user can select start date and end date based on that data get filter.

 

pls guide how to add date range filter.

Thx

  • Hi,

     

    I answered a question similar to this yesterday.  You may download my PBI file from here.

     

    Hope this helps.

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI Anonymous,

     

    Power bi not support direct operation on date range which define by two columns.

     

    You need to create a calculated table to store expand detail date and link to original table, then you simply use new data column as source of slicer to filter on date range.

     

    Sample table formula:

    Expand date table =
    VAR _calendar =
        CALENDAR ( MIN ( Table[start] ), MAX ( Table[end] ) )
    RETURN
        SELECTCOLUMNS (
            FILTER (
                CROSSJOIN ( Table, _calendar ),
                Table[start] <= [Date]
                    && Table[end] >= [Date]
            ),
            "id", Table[unique ID],
            "Date", [Date]
        )

     

    Build relationship based on 'id' column, then use new date column to create slicer to filter on original table.

     

    Regards,

    Xiaoxin Sheng

    • Anonymous's avatar
      Anonymous
      Not applicable

      time stamp can be removed, i  just need to filter based on date.

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        Hi,

         

        I answered a question similar to this yesterday.  You may download my PBI file from here.

         

        Hope this helps.