4 Replies Latest reply: Oct 10, 2013 4:55 AM by STEVEN GIORDANO IMBROLL RSS

    Set Analysis - How to still show all values witouth selections

    STEVEN GIORDANO IMBROLL

      Hi peeps,

       

      Wanted to check with you if this would be the best option when lets say, I have a Set Analysis on a field Sales.Period, and I would want to filter on that. However if there are no selections, I still want to show a value.  Usually if you do not select a the specific field, the sum will return Null.

       

      Would this be the best way in doing so?

      if(GetSelectedCount(Sales.Period)>0,

       

      Sum({<Sales.Period = {$(=only(Sales.Period-1))} >} Sales.Item_Qty*Sales.Item_Price_Inc_Vat),

       

      Sum(Sales.Item_Qty*Sales.Item_Price_Inc_Vat)

      )

       

      Thanks a lot

      Steve

        • Re: Set Analysis - How to still show all values witouth selections
          Stefan Wühl

          only() function will only return a value if there is one possible value, so if you make more than one selection, this will not work.

           

          Then,

          only(Sales.Period-1) is probably not correct, I assume you mean only(Sales.Period)-1

           

          What do you want to achieve here? Maybe try this:

           

          if(GetSelectedCount(Sales.Period)=1,

          Sum({<Sales.Period = {$(=only(Sales.Period)-1)} >} Sales.Item_Qty*Sales.Item_Price_Inc_Vat),

          Sum(Sales.Item_Qty*Sales.Item_Price_Inc_Vat)

          )

           

          So if you select single Sales.Period, like 100, the dollar sign expansion should return 99:

           

          if(GetSelectedCount(Sales.Period)=1,

          Sum({<Sales.Period = {99} >} Sales.Item_Qty*Sales.Item_Price_Inc_Vat),

          Sum(Sales.Item_Qty*Sales.Item_Price_Inc_Vat)

          )

           

          If you select more than one value or none, the ELSE branch should be executed:

          Sum(Sales.Item_Qty*Sales.Item_Price_Inc_Vat)

           

          You said, this returns Null, is this intendend? If not, fix this issue first before starting with the set modifier.