Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
kppiee
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
kppiee
Contributor II
Contributor II
Author

@sunny_talwar 

sunny_talwar
MVP
MVP

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

kppiee
Contributor II
Contributor II
Author

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?

sunny_talwar
MVP
MVP

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