Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to create a calculated dimension filed in a straight table in qlikview based on some conditions.
Please see the attached file for more details:
Let me know if you have any questions.
Thanks,
BC
Dont know your full requirement but you could do it script like below
ExampleTemp:
LOAD AC,
ID,
Category
FROM
[C:\Users\DR\Downloads\example (1).xlsx]
(ooxml, embedded labels, header is 2 lines, table is Sheet1);
left join
load ID,
if(Category='Ex',AC) as [New Field (AC2) to be created]
resident ExampleTemp
where Category='Ex';
NoConcatenate
Example:
load
AC,
ID,
Category,
if(len([New Field (AC2) to be created])=0,'UNASSIGNED',[New Field (AC2) to be created]) as [New Field (AC2) to be created]
resident ExampleTemp;
drop table ExampleTemp;
Output
| AC | ID | Category | New Field (AC2) to be created |
| OC | 349 | At | UNASSIGNED |
| TAP | 225 | Lb | UNASSIGNED |
| COR | 197 | Ex | COR |
| IP | 197 | Lb | COR |
| IR | 197 | At | COR |
| OC | 197 | At | COR |
| PE | 197 | At | COR |
| TAP | 197 | Lb | COR |
| IP | 122 | Lb | UNASSIGNED |
| IR | 122 | At | UNASSIGNED |
| SE | 122 | St | UNASSIGNED |
Dont know your full requirement but you could do it script like below
ExampleTemp:
LOAD AC,
ID,
Category
FROM
[C:\Users\DR\Downloads\example (1).xlsx]
(ooxml, embedded labels, header is 2 lines, table is Sheet1);
left join
load ID,
if(Category='Ex',AC) as [New Field (AC2) to be created]
resident ExampleTemp
where Category='Ex';
NoConcatenate
Example:
load
AC,
ID,
Category,
if(len([New Field (AC2) to be created])=0,'UNASSIGNED',[New Field (AC2) to be created]) as [New Field (AC2) to be created]
resident ExampleTemp;
drop table ExampleTemp;
Output
| AC | ID | Category | New Field (AC2) to be created |
| OC | 349 | At | UNASSIGNED |
| TAP | 225 | Lb | UNASSIGNED |
| COR | 197 | Ex | COR |
| IP | 197 | Lb | COR |
| IR | 197 | At | COR |
| OC | 197 | At | COR |
| PE | 197 | At | COR |
| TAP | 197 | Lb | COR |
| IP | 122 | Lb | UNASSIGNED |
| IR | 122 | At | UNASSIGNED |
| SE | 122 | St | UNASSIGNED |
Hi Dilipranjith,
Thank you so much for the solutions. I am very tempted to accept as the solutions i needed but i was trying to do it on the UI(Chart) side. Is there any way we could do it in the chart as a Conditional dimensions.
Thanks,
BC
not sure how feasible that is. but definitely would be slower than the script solution