Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
paulwalker
Creator II
Creator II

issue with flag

Hi Community,

facing issue with flag, please help what I did wrong.

This is my table...  (I'm trying to create flag, if market is 1 value should be 838  and if APH_MKT is 1 value should be 249)

IF(Market=1, 'Genaral', IF(APH_MKT=1, 'APH', 'N/A')) as Flag

IDAPH_MKTMarketSales
101200
201300
311230
41119
50189

Thanks in Advance

Labels (1)
6 Replies
paulwalker
Creator II
Creator II
Author

is there any possibility ??

Saravanan_Desingh

Your description shows, the condition should be like this,

IF(Market=1, 838, IF(APH_MKT=1, 249, 'N/A')) as Flag
paulwalker
Creator II
Creator II
Author

this is not static, it should be dynamic..

If records  are increase will based on data.

Saravanan_Desingh

I understand now. Check this.

Pick(Match(-1,APH_MKT=1,Market=1),Sum(TOTAL{<APH_MKT={1}>} Sales),Sum(TOTAL{<Market={1}>} Sales))

commQV30.PNG 

paulwalker
Creator II
Creator II
Author

Hi Saran,

i have to create falg like below, but this condition only satisfying for APHSS not for General market.

Pick(Match(-1,APHSS_MKT=1, GM=1),'APHSS', 'General Market') as Comparison;

Screen1: without any selection

paulwalker_0-1614833224646.png

Screen2: with Selection APHSS, working fine

paulwalker_1-1614833249590.png

Screen3: for General Market, it should map to everything, because in data whole column is 1

paulwalker_2-1614833271331.png

Hope you understand..

paulwalker
Creator II
Creator II
Author

This is the one solution,  but my data is very huge - I can't concatenate

Is there any other solution??

ABC:
LOAD *, 'APH' as flag where APH_MKT=1;
LOAD * INLINE [
ID, APH_MKT, Market, Sales
1, 0, 1, 200
2, 0, 1, 300
3, 1, 1, 230
4, 1, 1, 19
5, 0, 1, 89
];

CONcatenate
LOAD *, 'General Market' as flag;
LOAD * INLINE [
ID, APH_MKT, Market, Sales
1, 0, 1, 200
2, 0, 1, 300
3, 1, 1, 230
4, 1, 1, 19
5, 0, 1, 89
];