Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Give another name to data who meets the condition

Is it possible to give an own-given name to certain data which meets the conditions?

e.g.

Country, Customer, qty Customer Orders

Netherlands, A, 5

Netherlands, B, 7

Netherlands, C, 8

Belgium, N, 8

Belgium, O, 5

Belgium, P, 6

Germany, Q, 7

Germany, R, 7

Germany, S, 9

Condition is:

- if there are customers who have 8 or more than 8 customer orders, then I want to give that customer the name HEAVY (instead of their own customer name).

- Customers which have 6, more than 6, but less than 8 customer orders, should have the name MEDIUM (instead of their own customer name)..

- Customers whith less then 6 customer orders should have the name NORMAL (instead of their own customer name)..

Is this possible?

Kind regards,

ZR

11 Replies
jagan
Luminary Alumni
Luminary Alumni

HI,

Use below script

TableName:

LOAD

     Country,

     Customer,

     QtyOrders,

     If(QtyOrders >= 8, 'HEAVY',

          If(QtyOrders >= 6 AND QtyOrders < 8, 'MEDIUM',

               If(QtyOrders < 6, 'NORMAL'))) AS OrderSize

FROM Datasource;

Hope this helps you.

Regards,

Jagan.

swuehl
MVP
MVP

You can use conditional if() functions to do this, like

INPUT:

LOAD Country, [qty Customer Orders],

if([qty Customer Orders] >=8, 'HEAVY',

if([qty Customer Orders] >=6, 'MEDIUM', 'NORMAL')) as Customer


INLINE [

Country, Customer, qty Customer Orders

Netherlands, A, 5

Netherlands, B, 7

Netherlands, C, 8

Belgium, N, 8

Belgium, O, 5

Belgium, P, 6

Germany, Q, 7

Germany, R, 7

Germany, S, 9

];

Not applicable
Author

Is it also possible to change it in the condition of an expression?

jagan
Luminary Alumni
Luminary Alumni

Hi,

Please use the below expressions for Heavy, Medium and Normal

Heavy = Count({<[qty Customer Orders] ={'>=8'}>} Customer)

Medium =Count({<[qty Customer Orders] ={'>=6<8'}>} Customer)

Normal=Count({<[qty Customer Orders] ={'<6'}>} Customer)

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

I have tried, when entering above condition in the expression, it says:
"Garbage after 'Heavy'"

jagan
Luminary Alumni
Luminary Alumni

Hi,

Did you used the above in Load Script?  If yes, use this script as Chart Expressions in chart not in Load script.

Can you attach a sample file.

Regards,

Jagan.

Not applicable
Author

Hi,

No, I have used your script in the Edit Expression in the tab Expressions of the chart... so that should be ok.

It's a bit hard to attach a sample file, because there is company information in it.

How can we solve this?

Btw, thank you for your effort.

Regards,

ZR

v_iyyappan
Specialist
Specialist

Hi,

     I attched a sample QV file. May be its helpful for u.

Regards,

Iyyappan

Not applicable
Author

Thank you, it is helpful, but I'm still not there, because I want to show the data in a pie chart, or in a line chart. is that possible?