Forum Discussion

mohammadrafic's avatar
5 years ago
Solved

calendar selectedvalue compare another table

  hi , i have calendar table and used in below calendar slicer. how can i get the selectedvalue which is highlight in red.  and it shoud compare with another table date column which is available or...
  • ITManuel's avatar
    ITManuel
    5 years ago

    Hi  ,

     

    I tried the following:

    - Calendar is your Calendar table

    - Calendar1 is your other table which contains the dates to check existence in your selection

     

     

    1. Create measure to return Selected Max Date 

     

     

    SelectedMaxDate = 
    VAR SelectedMaxDate = 
        CALCULATE(
            MAX('Calendar'[Date]),
            ALLSELECTED('Calendar')
        )
    RETURN
    SelectedMaxDate

     

     

     

    1. Create measure to check weather Selected Max Date is part of Calendar1. If yes, return "" otherwise return "Error".

     

     

    CheckDate = 
    VAR CheckDate = 
        CONTAINSROW(VALUES(Calendar1),[SelectedMaxDate])
    VAR Result =
        IF(
            CheckDate,
            "",
            "Error"
        )
    RETURN
        Result

     

     

     

    PBiX file under the link below:

    https://we.tl/t-GDrBRxvXYC

     

    Best regards