Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Everyone,I have a problem about making a chart like below,
Comments:
Levels:A、B、C (with the sales data)
So, how to write the expression with a chart in the Sample?
Best Regards!
From Your Example, What are you expecting?
thanks for your reply , perhanps it's a dynamic dimension case. It will help a lot if you make it out.
The representation is bit confusing, can you try mapping all of your example values in your representation.
For example, ID001, Year 2014, Sales=4, you didn't show it in pic. If you can map your 6 example values in expected output, I think I can make equivalent in pivot table.
Your sales numbers are not tagged in the source data. But I just assumed and mapped it to you source data. So take a look and see if this helps:
thanks for reply, I 'm sorry for confusing you, please see the question above, I have modified it.
thanks for your reply, the field "Level" in your reply is not suspected to exist, for it's dynamic with other fields selecting
May be I am missing something but all I am asking is you have 3 values for 2014 and 3 values for 2015. Since you are showing 2014 and 2015 values separately, vertical(2015 values as rows) and horizontal(2014 values as columns), all I want to see 6 values in expected output.
all values must falls into one of the 3 conditions so we should see 6 1's corresponding to 6 values.
I made the change to reflect the 'Level' in the code:
t:
Load *,
IF(Sales<=5,'A',If(Sales >5 and Sales <=10,'B',If(Sales >10,'C'))) as Level;
LOAD * INLINE [
ID, Year, Sales
ID001, 2014,4
ID002, 2014,8
ID003, 2014,12
ID001, 2015,7
ID002, 2015,11
ID003, 2015,4
];
QUALIFY *;
UNQUALIFY ID;
t1:
LOAD *
Resident t;