Skip to main content
Question

Need to build a KPI using three or more columns rules

  • October 28, 2021
  • 6 replies
  • 7 views

Forum|alt.badge.img+7

Hi Team,

 

I'm trying to build a KPI shows which column data has wrong fields.

I'm using the KPI syntax as below but it is not working. Could you please help me on this case.

CASE WHEN LEN ("TableA_xlsx_TableA"."Name") > 4 OR ("TableA_xlsx_TableA"."Name") IN_LIKE ('!','@','#','$','^','*','(',')','-','_','+','=','{','}','[',']','|','/',':',';','"','<','>',',','.','?','[%]') THEN 'Name, ' ELSE '' END ||

CASE WHEN ("TableA_xlsx_TableA"."Country") IN_LIKE ('!','@','#','$','^','*','(',')','-','_','+','=','{','}','[',']','|','/',':',';','"','<','>',',','.','?','[%]') THEN 'Country, ' ELSE '' END ||

CASE WHEN ("TableA_xlsx_TableA"."SubID") IN_LIKE ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9') THEN 'SubID' ELSE '' END

 

KPI

6 replies

  • Level 8
  • October 29, 2021

Hi Gundappa,

 

I've tested your code and should work:

image.pngI've only changed the Table names when transforming the file upload.

 

In the next picture you can see the results

analysisThis analysis shows an OLAP TABLE with a custom KPI with the PQL code you provided and it works!!

 

Sorry to don´t find a bug,

 

Javier

 

 

 

 


Forum|alt.badge.img+7

Hello Javier,

 

Thank you for the answer. Could you please help with handling the null values, if there are any null values in any of the column then the code is not working for that row.KPI2 

Code is:

CASE WHEN LEN ("NEW_xlsx_Sheet1"."NAME") > 4 OR ("NEW_xlsx_Sheet1"."NAME") IN_LIKE ('!','@','#','$','^','*','(',')','-','_','+','=','{','}','[',']','|','/',':',';','"','<','>',',','.','?','[%]') THEN 'Name, ' ELSE '' END ||

CASE WHEN ("NEW_xlsx_Sheet1"."COUNTRY") IN_LIKE ('!','@','#','$','^','*','(',')','-','_','+','=','{','}','[',']','|','/',':',';','"','<','>',',','.','?','[%]') OR LEN ("NEW_xlsx_Sheet1"."COUNTRY" ) > 4 THEN 'Country, ' ELSE '' END ||

CASE WHEN ("NEW_xlsx_Sheet1"."SUBID") IN_LIKE ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9') THEN 'SubID' ELSE '' END

 

Output is as below

 

KPI2Thanks in advance for your help!

 

Gundappa

 

 

 

 


  • Level 8
  • October 29, 2021

👍


  • Level 8
  • October 29, 2021

Hi Gundappa

 

I think with an additional check wheter is null the column would make the deal, for instance for the first part of the query I owuld try:

CASE WHEN

(ISNULL("TableA_xlsx_TableA"."Name") = 0)

AND 

(LEN ("TableA_xlsx_TableA"."Name") > 4

OR ("TableA_xlsx_TableA"."Name")  IN_LIKE ('!','@','#','$','^','*','(',')','-','_','+','=','{','}','[',']','|','/',':',';','"','<','>',',','.','?','[%]'))

 

 

Hope it helps

Javier


Forum|alt.badge.img+7

Hi Gundappa

 

I think with an additional check wheter is null the column would make the deal, for instance for the first part of the query I owuld try:

CASE WHEN

(ISNULL("TableA_xlsx_TableA"."Name") = 0)

AND 

(LEN ("TableA_xlsx_TableA"."Name") > 4

OR ("TableA_xlsx_TableA"."Name")  IN_LIKE ('!','@','#','$','^','*','(',')','-','_','+','=','{','}','[',']','|','/',':',';','"','<','>',',','.','?','[%]'))

 

 

Hope it helps

Javier

THANKS TON Javier. Now I'm able to handle the null values 😊


  • Level 8
  • October 29, 2021

👏 Glad to help

Regards