Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

prohibit multiple selection with a year slicer

Hello,

 

In table Calendar, I have the field named Fiscal Year.  Using a flag, I am able to restrict the use of the two last years.  For example, 2018 and 2019.  However, I would like to avoid the end-user to make multiple selections (2018 and 2019).  In Selection control, I have set show select all options to off.  Even that, using the ctrl key, the user can select 2018 and 2019.

 

Does someone know how to avoid that situation in order to permit to select either 2018 or 2019 but not both?

Regards,

alepage

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    No way that I know of. However, you could enforce it on your measures by using HASONEVALUE and if not, return an error or BLANK perhaps.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello Greg,

       

      I am not sure I understand what you are proposing.

      What I have done it is to define two key measures as follow:

       

      CurrentYear = Year(NOW())
      StartingYear = Year(now()) - 1

       

      Then in my table Calendar, I have define a new variable FlagFiscalYear.

       

      FlagFiscalYear = SWITCH(true(),
      'dim Calendar'[fiscalyear] = 'Key Measures'[StartingYear],1 ,
      'dim Calendar'[FiscalYear] = 'Key Measures'[CurrentYear],2 ,
      0)

       

      Thereafter, I use a page filter where the FlagFiscalYear need to be greater then zero.

       

      But the user can select both year, something I don't want.  You are proposing the use of hasonevalue but I don't know how to do that?  Can you provide me an example