Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a line chart. Depending on the users selection sometimes the lines are two thin to really see, but when there are a huge number of lines if they are any thickier they will obscure the content. Therefore what I really want to do is have a line style of 0.2 if the Distinct count of a specific field (LineNumberPatientID_Combined) is less than 50. I have been trying to achieve this with the following formula:
IF(Count({$}LineNumberPatientID_Combined)<50,'<W2>','<W8>')
This doesn't seem to achieve what I wanted, regardless of the selection it appears to always use W2.
Any guidance would be greatly appreciated.
Thanks
Dan
Daniel
Would this suffice ?
=IF(GetPossibleCount ( [LineNumberPatientID_Combined] ) <50 , '<W2>' , '<W8>')
Best Regards, Bill
Hi
Does Count(LineNumberPatientID_Combined) return a value for each column? Add that as an expression to your chart to ensure that evaluates properly and is in the range you expect.
HTH
Jonathan
Thanks for the suggestion. I have added Count(LineNumberPatientID_Combined) as an expression. I have checked that the total is sometimes above and sometimes below 50. However with my current Line Style formula I still only get the first value (W2) regardless of the user selection.
Daniel
Would this suffice ?
=IF(GetPossibleCount ( [LineNumberPatientID_Combined] ) <50 , '<W2>' , '<W8>')
Best Regards, Bill
Maybe IF(Count(total {$}LineNumberPatientID_Combined)<50,'<W2>','<W8>')
Thanks everyone for your help. Bill and Clevere Anjos suggestion both work perfectly thank you. I was just curious on a couple of points. Is it better to use Set Analysis or an IF statement for this task? Does it matter?
In addition my actual requirements are slightly more complicated as I want any lines with a backflow to also be dotted (but the width should be reflective of the count). I have taken Bill's example and added the tweaks I needed resulting in the following code:
=
IF(GetPossibleCount ( [LineNumberPatientID_Combined] ) <50 AND FlowDirection = 'Backwards' , '<S2><W2>' ,
IF(GetPossibleCount ( [LineNumberPatientID_Combined] ) <50,'<W2>' ,
IF(GetPossibleCount ( [LineNumberPatientID_Combined] ) >=50 AND FlowDirection = 'Backwards' , '<S2><W0.2>',
'<W0.2>')))
It works perfectly (thank you for your help guys) however I was just wondering if there is any way I should/could get rid of the nested IF statement.
Thanks in advance.
Dan
Daniel
Your questions are very valid.
Calculated Dimensions can cause performance issues as they are recalculated every time any Selections are changed, whether or not the object in question is active or not. However this IF statement is not a Calculated Dimension per se, but is an expression related to the Dimension's display attributes. I have no idea whether this is good or bad for performance.
However I cannot see that the GetPossibleCount ( [LineNumberPatientID_Combined] ) in the IF will be resource hungry.
For the Set Analysis Count(total {$}LineNumberPatientID_Combined) similarly I do not believe that would be resource hungry either and Set Analysis is generally an efficient way of doing things.
So I think it is pretty much of a muchness as to which way you go.
I personally see nothing wrong with using a nested IF, indeed I cannot think of an alternative.
I would be very interested to hear the view of cleveranjos on this, as he certainly has more experience than I.
Best Regards, Bill
This nested IF could hard to mantain, but not very resource intensive.
I don´t see an easy way of get rid of this, because they´re 'different' tests, not just a a bucket we should calculate.
Bill Markham, we´re colleagues here, my friend, I think we´re at the same level