Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have table1 with fields item1 and category, table2 with item2. Now I'm creating a dimension to get category for item2 in expression editor.
I need some function like:
IF(item2=item1, category)
How should I do this?
Any advice helps. Thanks in advance!
You may define a calculated dimension
If(item1=item2,item1) (uncheck 'include null values')
and define Only(cat) as measure
This worked for me
If table1 and table2 are defined as follows, left joining table2 with table1 will give the required category (catforitem2) as seen below:
table1:
load * inline [
item1,category
1,cat1
2,cat2
3,cat3
4,cat4];
table2:
load * inline [
item2
2
3
];
left join (table2) load item1 as item2, category as catforitem2 resident table1;
HTH
Thanks for helping. Is there a way to do this in chart rather than in script?
You may define a calculated dimension
If(item1=item2,item1) (uncheck 'include null values')
and define Only(cat) as measure
This worked for me
As per me you don't need a condition also here, just rename the item2 in your script as item1 since they share the same data contain it will automatically gets picked !!