Forum Discussion

TusharGaurav's avatar
TusharGaurav
Icon for Helper III rankHelper III
1 year ago

How to filter data from 2 table based different date conditions while having only one date slicer?

Hi Experts,

 

I have 2 table having data as below:

Table1:

Order NumberOrder TypeTransaction DateModification DateInvoice NumberRevenue
12345OT121-Sep-2422-Sep-243423423413741.86
87863OT222-Sep-2423-Sep-24453421620
68469OT323-Sep-2428-Sep-2435243535900
553742OT424-Sep-2429-Sep-2445235251620

 

Table 2:

Order NumberOrder TypeModification DateItem NumberProduct codeGeography code
12345OT122-Sep-2441591074wqewq11
87863OT223-Sep-2441324274dcsac22
68469OT328-Sep-2441246418esafdsa23
553742OT429-Sep-2436594912fsdfd34

 

Both the tables are joined on Order Number.

 

I should have a "Date Slicer" where

for table 1,the date condition should be as below:

Date_Slicer_Date > ModificationDate and Date_Slicer_Date <= Transaction Date

for table 2,the date condition should be as below:

Date_Slicer_Date > ModificationDate 

So if date selected in the data slicer is 23-Sep-2024 then only record corresponding to order number 68469 should be displayed and my table visual should look like as below:

Order NumberOrder TypeTransaction DateModification DateInvoice NumberRevenueItem NumberProduct code
68469OT323-Sep-2428-Sep-243524353590041246418esafdsa2

 

Can you please suggest how to achieve this scenario using only one date slicer?

Thanks and Regards,

Tushar Gaurav

 

8 Replies

  • TusharGaurav 

     

    You can have third table (Dim Date) and select slicer from thsi table.

     

    or the other solution is not to connet these two tables together and just using a measure ( find selected values of table 1 in table2 and use if to be able to filter them in visual level)

     

    If this post helps, then I would appreciate a thumbs up 👍 and mark it as the solution to help the other members find it more quickly. 

    • TusharGaurav's avatar
      TusharGaurav
      Icon for Helper III rankHelper III

      Hi Selva,

       

      Thanks for your response.

      Unfortunately I am not able to understand your suggestion.

      Can you please be a little bit more elaborative using the sample data that I shared.

       

      Thanks and Regards,

      Tushar Gaurav

      • Selva-Salimi's avatar
        Selva-Salimi
        Icon for Solution Sage rankSolution Sage

        TusharGaurav 

         

        Would you please clarify how you define condition of your slicer and also from which table have you choosed your date slicer?

  • Hi Selva,

     

    That is what I need to know.

    The business requirement is as below:

    I should have a "Date Slicer" where

    for table 1,the date condition should be as below:

    Date_Slicer_Date > ModificationDate and Date_Slicer_Date <= Transaction Date

    for table 2,the date condition should be as below:

    Date_Slicer_Date > ModificationDate 

    In the date slicer I am planning to use "Modification Date"

    • Selva-Salimi's avatar
      Selva-Salimi
      Icon for Solution Sage rankSolution Sage

      TusharGaurav 

       

      I recommend you to have another table which can call your Date table and the slicer on the dashboard should be from this table. to generate the dates you can create a table, insert the minimum date you need, go to transform data, click on custom column and define a new column using following formula: ( keep in mind that 1000 is number of days you need to have following the start date) and Call this table DimDate

       

      List.Dates ([Start] , 1000 , #duration( 1, 0, 0, 0))

       

      and then click on the generated column and select expand to new row. you also can delete other columns.

       

      after that using this measure for first table:

      measure 1 := if ( selectedvalue ('Dimdate' [Dates]) > 'table 1' ModificationDate && selectedvalue ('Dimdate' [Dates]) <= 'table 1' Transaction Date , 1 , 0 )

       

      write another measure for table 2 as follows:

       

      measure 2 := if ( selectedvalue ('Dimdate' [Dates]) > 'table 2' ModificationDate , 1 , 0 )

       

      ** delete the relation between your tables**

       

      add this two measure in visual level filter of each table and set it to 1.

       

      If this post helps, then I would appreciate a thumbs up and mark it as the solution to help the other members find it more quickly. 

      • TusharGaurav's avatar
        TusharGaurav
        Icon for Helper III rankHelper III

        Hi Selva,

         

        I have tried the steps but its not working for me.

        I am sharing the .pbix file.

        Can you please check if you have bandwidth.

        test.pbix

         

        Thanks and Regards,

        Tushar Gaurav