Forum Discussion

wiktor_nus's avatar
wiktor_nus
Regular Visitor
4 years ago

ffilter two tables

Hello, I would like to filter two tables in the report, the tables have no relationship. In both tables there is a "date" field and I would like to put a filter on that it also affects the other table.

4 Replies

  • wiktor_nus , My advice would be to create a date table join with those two and use that as slicer

     

    Or have measures like

     

    calculate(Sum(Table1[Value]), filter(Table1, Table1[Date] in values(Table2[Date]) ) )

     

    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

    • wiktor_nus's avatar
      wiktor_nus
      Regular Visitor

      unfortunately they are connected by a different relation which does not allow for a connection after the date field.
      unfortunately this measure does not work:
      calculate(Sum(Table1[Value]), filter(Table1, Table1[Date] in values(Table2[Date]) ) )

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi wiktor_nus ,

     

    There are several ways:-

     

    1. Put same filter on both the tables.

    2. or Create a date table and join it with both the table and put filter on date table so it will filter other tables.

     

    Thanks,

    Samarth

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Community Support

    Hi, wiktor_nus ;

    You could try it.

     

    measure=calculate(Sum(Table1[Value]), filter(Table1, Table1[Date] in allselected(Table2[Date]) ) )

     

    Or Can you post sample data as text and expected output?

    The best way is create a measure to contorl two table without relationship.

     

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.