1 Reply Latest reply: Jan 3, 2018 12:56 PM by omar bensalem RSS

    Conditional selection

    krishna b

      Hi All,

      I created donut chart using below expressions.


      Dimension: Status =Availability , Unavailability

      Measure: if(Status ='Availability',Only({<Affected_Date={'$(=Max(Affected_Date))'}>}[Overall Availability%]),

      if(Status='Unavailability',Only({<Affected_Date={'$(=Max(Affected_Date))'}>}[Unavailability%])))


      My requirement:

      Without any selection display only Todays data

      If select Month display that month data.

      If select Year display that Year data.


      I created below code for text box

      Ex: =if(GetSelectedCount(Affected_Month)>0,Round(Sum([Overall Availability%])/Count([Overall Availability%]))&''& '%',

      Only({<Affected_Date={'$(=Max(Affected_Date))'}>}[Overall Availability%])&''& '%')


      How to create same code for donut chart.

       

      Thanks,

      Krishna

        • Re: Conditional selection
          omar bensalem

          maybe sthing like;

          =if(GetSelectedCount(Affected_Month)=0 and GestSelectedCount(Year)=0,


          if(Status ='Availability',Only({<Affected_Date={'$(=Today())'}>}[Overall Availability%]),

          if(Status='Unavailability',Only({<Affected_Date={'$(=today())'}>}[Unavailability%])))

          ,

          if(Status ='Availability',Only([Overall Availability%]),

          if(Status='Unavailability',Only([Unavailability%])))


          )


          I mean, if u select a month or a year , u want to show the measure for the selected frame; thus no need to force sthing within the set expression; Qlik will automatically bring the measure for the selected time frame