Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Selected Value filter not working properly

Hello, I'd like to filter the start-end date of employee leave record based on a selected date. I'm using the following DAX but it seems to be not working. Please help.

 

SelectedDate = CALCULATE(SUM(Leave[ContactID]), 
FILTER(Leave,
SELECTEDVALUE('Calendar'[Date]) <= ALL(Leave[LeaveFrom])
&& SELECTEDVALUE('Calendar'[Date]) >= ALL(Leave[LeaveTo])
 ))

 

2 Replies

  • v-frfei-msft's avatar
    v-frfei-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    To update your measure as below to have try. If it doesn't meet your requirement, kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

     

    SelectedDate =
    CALCULATE (
        SUM ( Leave[ContactID] ),
        FILTER (
            Leave,
            SELECTEDVALUE ( 'Calendar'[Date] ) <= Leave[LeaveFrom]
                && SELECTEDVALUE ( 'Calendar'[Date] ) >= Leave[LeaveTo]
        )
    )
    
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi v-frfei-msft 

       

      Thank you so much for replying.

      I have one table which contains employee leave data, typically it contains employee name, leave start and leave end date. I have two other tables, contains project and user's timesheet information. 

       

      What I wanted is to filter the user's timesheet and its leave information based on the date selection from the Calander table.

       

      For example: if a user is going on leave from 4th Mar - 20th Mar, and If I select 15th Mar from the calendar, I should be able to see leave information of that particular user on that selected date along with all the planned task he has been assigned to that date.

       

      Here is the link to the power bi file: https://1drv.ms/u/s!AkX-WgOcYFxrh0ylE2BQtYvcKfsr

      and see Page 1.