Forum Discussion

misc981's avatar
misc981
Frequent Visitor
1 year ago
Solved

Filter table based on selection in another table

I have a SP datasource describing user leave requests with columns 'Leave Type, 'To' and 'From' columns. The exact dates for each and every day is not available, only the 'To' and 'From' columns. Our other apps calculate and determine if and how long the user wil lbe on leave based on these two column.

I have created 7 tables in Power Query to calculate the leave count for the each day, for the next 7 days including current day. Each table is then.

I have created 7 table visuals for each of the tables. These 7 visuals need to be visible at all times.

I have created 7 measures to calculate the dates for the next 7 days, and assigned each measure to the each of the 7 visuals.

I have created a seperate table visual to show the actual leave request details, with the SP list as the datasourece.

Is it possible to filter the visual with the leave details, based on the date of the table selected, and leave type selece

  • Don’t make 7 tables → create one Next7Days table with dates TODAY() → TODAY()+6.

     

    Use a measure like:

     

    IsOnLeave =
    VAR d = SELECTEDVALUE(Next7Days[Date])
    RETURN IF( MAX(Leaves[From]) <= d && MAX(Leaves[To]) >= d, 1, 0 )


    Filter the leave detail table with IsOnLeave = 1.

    Add slicer for Leave Type → both date + type filter will apply.

     

    Much cleaner than 7 visuals.

5 Replies

  • Hi misc981 
    Please help us help you. Please provide a workable sample data (not an image), your expected result from the same sample data and your reasoning behind.  The sample data must represet the structure of your actula data. You may post a link to Excel or a sanitized copy of your PBIX stored in the cloud. 

  • Shahid12523's avatar
    Shahid12523
    Community Champion

    Don’t make 7 tables → create one Next7Days table with dates TODAY() → TODAY()+6.

     

    Use a measure like:

     

    IsOnLeave =
    VAR d = SELECTEDVALUE(Next7Days[Date])
    RETURN IF( MAX(Leaves[From]) <= d && MAX(Leaves[To]) >= d, 1, 0 )


    Filter the leave detail table with IsOnLeave = 1.

    Add slicer for Leave Type → both date + type filter will apply.

     

    Much cleaner than 7 visuals.

  • v-sshirivolu's avatar
    v-sshirivolu
    Community Support

    Hi misc981  ,

    I would also take a moment to thank Shahid12523 , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
     

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions

    • v-sshirivolu's avatar
      v-sshirivolu
      Community Support

      Hi misc981 ,
      I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you

       

      • v-sshirivolu's avatar
        v-sshirivolu
        Community Support

        Hi misc981 ,
        I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions