Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

Create variable and use in Calculated field or variable with if else condition in table

I need to create or use variables in calculated field so I can see the result in table.

Because I need to create another field based on result field.

Below are table example - I need Permission.Check based on below power BI dax query:

 

Power BI DAX Queries given below. I need syntax similar to these:-

Column1Column2Column3Column4Column5Permission.Check
1PermissionJohn AllowPermission
1PermissionJohn AllowPermission
1DeleteJohn AllowPermission
2PermissionJohn AllowDelete
2PermissionJohn AllowDelete
2DeleteJohn AllowDelete
2DeleteJohn AllowDelete
3PermissionJohn Allow 
3DeleteJohn Allow 
4PermissionJohnXYZAllow 
4DeleteJohn Deny 

 

Permissions.Check =

VAR Permissions = CALCULATE(COUNTROWS(TableName),ALLEXCEPT(TableName,TableName[column1],tableName[column2]))

VAR Delete =
    CALCULATE(
        COUNTROWS(TableName),
            FILTER(
                ALLEXCEPT(TableName,TableName[column1],TableName[column2]),
                    TableName[column3]="John"&&
                    ISBLANK(TableName[column4])
                )
            )

RETURN
SWITCH(TRUE(),
    TableName[column5]<>"Allow",BLANK(),

    Permissions=2&&Delete=1,"Permission",

    Permissions=2&&Delete=2,"Delete",

   BLANK()

)
4 Replies
Highlighted
Contributor II
Contributor II

@sunny_talwar 

Highlighted

Can you explain in simple words, what exactly are you looking to do? Also, are you trying to do it in the script?

Highlighted
Contributor II
Contributor II

I need the result in permission.check column based on other columns count. Is it possible from variable or dimensions?

I am looking for the solution after the data load. Any solution?

Highlighted

What exactly are your condition to count? I don't understand the code that you have listed, can you put that in plain simple words also. Thanks