Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

How to find out the company/brand name that have max %

More
4 years 7 months ago #188530 by Ni3
Hi team,

I have a question asking for purchase volume (in %) in company

Q1 (Array - number)

Company Share in %
Company A 20%
Company B 50%
Company C 30%



I want to find out which Company have highest percentages. I need the Company name so that I can pipe it into next question

Next question is
Q2.Please rate the following statements for the company you named [Company Name] where you buy the most ….

I tried using max function in the equation type question but I am only getting the percentage value, how I will gate the name of the company?

Q1a – equation type.

{max(Q1_1_ SQ001.NAOK, Q1_2_ SQ001.NAOK, Q1_3_ SQ001.NAOK)}


Thanks for your help
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188532 by Joffm
Hi,

you have your equation to calculate the maximum (Q1a).
Just compare the values of the companies with this maximum in an if-statement.

{if(Q1_1_ SQ001==Q1a,"Company 1",if(Q1_2_ SQ001==Q1a,"Company 2",if(Q1_3_ SQ001==Q1a,"Company 3","Company4")))}

Furthermore you have to decide what to do if two companies have the same value.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose