
1. Re: IF function  Am I doing it wrong?
Brad Llewellyn Apr 17, 2013 5:37 AM (in response to Ben Price)1 of 1 people found this helpfulAndrew,
The condition in your if statement is at the rowlevel and your outcome is at the tablelevel. This is why Tableau doesn't like it. Try
COUNTD(
IF [Answer]="£5,000.00" THEN [RespondentID] END
) * 5000
Brad Llewellyn
Associate Consultant
Mariner, LLC
brad.llewellyn@marinerusa.com

2. Re: IF function  Am I doing it wrong?
Ben Price Apr 17, 2013 7:45 AM (in response to Brad Llewellyn)Hi Brad,
Thanks alot for the help, that seems to work.
However, how would I nest that? for example, I have 6 different arguments that I would like to calculate in one go  £5k, £30k, £75k, £175k, £375k and £500k. Therefore, I can't nest them all under one count as they will all be multiplied by the same number...
Also, as you were so quick on it, do you have any suggestions on calculating the average from all of those?
Many Thanks

3. Re: IF function  Am I doing it wrong?
Brad Llewellyn Apr 17, 2013 7:50 AM (in response to Ben Price)1 of 1 people found this helpfulBen,
You should be able to add all of them together as follows:
COUNTD(
IF [Answer]="£5,000.00" THEN [RespondentID] END
) * 5000 +
COUNTD(
IF [Answer]="£30,000.00" THEN [RespondentID] END
) * 30000 + ...
However, this is not optimal. I wish I had the data to play with. There are quite a few ways to do this better, but they would depend on how you plan on visualizing the data. Could you post a mockup or .twbx?
Thanks,
Brad Llewellyn
Associate Consultant
Mariner, LLC
brad.llewellyn@marinerusa.com

4. Re: IF function  Am I doing it wrong?
Ben Price Apr 17, 2013 7:59 AM (in response to Brad Llewellyn)Hi Brad,
There should be a sample of the data above, can you work with that?  All you have to do is connect it to a workbook and it should pull it in as I have it here?

5. Re: IF function  Am I doing it wrong?
Ben Price Apr 17, 2013 8:01 AM (in response to Ben Price)I have managed to find a workaround, although it's less than optimal, so I think there may be issues with the way I have setup the data.
What I've done is duplicated that calculation for all 6 variables then added in another calculation that aggregates all the previous calculations:
([£5k]+[£30k]+[£75k]+[£175k]+[£375]+[£500k])/COUNTD([RespondentID])
Is this the best way or is there another one that I'm missing?

6. Re: IF function  Am I doing it wrong?
Brad Llewellyn Apr 17, 2013 8:31 AM (in response to Ben Price)Ben,
Take a look at this mockup. It utilizes that "more efficient" approach that I mentioned earlier. Does this help?
Brad Llewellyn
Associate Consultant
Mariner, LLC
brad.llewellyn@marinerusa.com

Book1.twbx.zip 30.9 KB


7. Re: IF function  Am I doing it wrong?
Ben Price Apr 18, 2013 6:55 AM (in response to Brad Llewellyn)Thanks Brad, that helps a lot!