Expression Simplification

Dear Friends,

       I am using this expression ISNOTBLANK(Filter Dashboard[Courier Name]) as a part of long IF () statement . Due to up-gradation of the app features, I want to refer to specific user with help of USEREMAIL() function. 

I could develop this expression Isnotblank(Select(Filter Dashboard[Courier Name],[[EMAIL] = useremail())) but as per @MultiTech , @Suvrutt_Gurjar advice select () is expensive or brute force function so I am planning to avoid it. 

I request you all to help me in writing simplified expression for the above.

with regards

Jaichith J

Solved Solved
1 9 246
2 ACCEPTED SOLUTIONS

If you have a Current_User slice, you can include this - as long as the filter records have something that matches them to a user (email or ID)

[Filter_User_Link] = Index(Current_User[UserID], 1)

Include something like that in your and() statement, this will tie it to your user.

View solution in original post

THANKS MATT @MultiTech ,

                          I HAVE FIXED THE ISSUE WITH YOUR ADVICE AND WITH THE HELP OF YOUR REFERENCE APP ENHANCED DASHBOARD . INITIALLY I COULD NOT UNDERSTAND THE LOGIC BEHIND YOUR APP. LATER UNDERSTOOD, IT WAS SUPERB.

THANKS FOR YOUR VALUABLE AND EFFORTS FOR THIS COMMUNITY. 

STEPS TAKEN:

1. A SLICE HAS BEEN CREATED FOR THE FILTER DASHBOARD TABLE WITH THE ROW FITLER CONDITION [EMAIL] = USERMAIL().

SLICE NAME : FILTER DASHBOARD USERMAIL

2. A SLICE HAS BEEN CREATED FROM THE MAIN DATASET (CONSIGNMENT TABLE) WITH ROW FILTER CONDITION  

SLICE NAME : FILTERED RESULTS

ISNOTBLANK(INDEX(FILTER DASHBOARD USER EMAIL[AGENCY NAME],1)).........

SELECT () FUNCTION HAS BEEN  SUBSTITUTED WITH ABOVE EXPRESSION LOGIC

MERITS : EXPENSIVE OR BRUTE FORCE SELECT () FUNCTION HAS BEEN AVOIDED. 

 

SPECIAL THANKS TO @AleksiAlkio FOR TAKING EFFORTS

View solution in original post

9 REPLIES 9

Is it affecting or not, it depends on where the formula is used. If it's in the virtual column, yes then it affects every time when you sync.. together with the data amount. But if it's with an app formula,Valid_If, Suggested values, initial value etc., in general, it only affects the app template size.

Yes, this expression will be used in virtual column and as row filter condition too. 

This post is a continuation of the earlier post where the solution was given by you ( @AleksiAlkio ) a few months before -  filter option with enum list

 

Kindly help me with this


@jaichith wrote:

I am using this expression ISNOTBLANK(Filter Dashboard[Courier Name]) as a part of long IF () statement . Due to up-gradation of the app features, I want to refer to specific user with help of USEREMAIL() function. 


Have you tried applying a user-specific filter to the Filter Dashboard slice?
  - Meaning: the slice itself includes a condition matching the current user's email or ID to the filter records - on top of whatever criteria may already be there.

  • If this slice is filtered to the current user, then you can count on the blank-or-not presence working.
    • This offsets the computational load for finding the user specific records to the slice, which computes during the sync primarily.
    • So when you go to retrieve the value, you're not computing anything - simply calling the values computed during sync time.

With this change, you can leave your formulas that use the filter slice as they are.  Instead of applying the user specific filtering in the formulas, you apply it at the "source" of the formula's answer... the slice.

 

Hi @MultiTech , 

                Filter dashboard table has a slice with a condition so that current user matching records so that an user can get his row in filter dashboard slice for filtering records of consignment table. In this slice (filter dashboard) user gives inputs for the filtering of consignment table. In Consignment table useremail() is not  important but it has a slice with the row filter condition that works based on the inputs given by the user at filter dashboard table. 

jaichith_0-1698850998141.png

 

consignment table slice : filter db 

jaichith_1-1698851269444.png

but this length expression doesn't checks for current user row in filter dashboard table. 

(Note: Earlier filter dashboard table had a single row . Now each user is allotted with separate row ). 

now I need a simple expression which looks for the current user row too. 

 

If you have a Current_User slice, you can include this - as long as the filter records have something that matches them to a user (email or ID)

[Filter_User_Link] = Index(Current_User[UserID], 1)

Include something like that in your and() statement, this will tie it to your user.

Matt, could you please give me an example.

Just for your reference . below expression checks for the filter dashboard[courier name] is blank or not. kindly convert the expression per my need. 

and(

IF(
      ISNOTBLANK(Filter Dashboard[Courier Name]),
           OR(
                  IFS(
             IN("EMPTY",Filter Dashboard[Courier Name]),ISBLANK([Courier Name])),
             IN([Courier Name],Filter Dashboard[Courier Name])
            ),
          ISNOTBLANK([Consignments ID])
),

if(isnotblank(Filter DASHBOARD[AGENCY NAME]),
          OR(
                   IFS(
       IN("EMPTY",Filter Dashboard[AGENCY NAME]),ISBLANK([AGENCY NAME])),
         IN([AGENCY NAME],Filter DASHBOARD[AGENCY NAME])
                        ),
           isnotblank([CONSIGNMENTS ID])
)

)

THANKS MATT @MultiTech ,

                          I HAVE FIXED THE ISSUE WITH YOUR ADVICE AND WITH THE HELP OF YOUR REFERENCE APP ENHANCED DASHBOARD . INITIALLY I COULD NOT UNDERSTAND THE LOGIC BEHIND YOUR APP. LATER UNDERSTOOD, IT WAS SUPERB.

THANKS FOR YOUR VALUABLE AND EFFORTS FOR THIS COMMUNITY. 

STEPS TAKEN:

1. A SLICE HAS BEEN CREATED FOR THE FILTER DASHBOARD TABLE WITH THE ROW FITLER CONDITION [EMAIL] = USERMAIL().

SLICE NAME : FILTER DASHBOARD USERMAIL

2. A SLICE HAS BEEN CREATED FROM THE MAIN DATASET (CONSIGNMENT TABLE) WITH ROW FILTER CONDITION  

SLICE NAME : FILTERED RESULTS

ISNOTBLANK(INDEX(FILTER DASHBOARD USER EMAIL[AGENCY NAME],1)).........

SELECT () FUNCTION HAS BEEN  SUBSTITUTED WITH ABOVE EXPRESSION LOGIC

MERITS : EXPENSIVE OR BRUTE FORCE SELECT () FUNCTION HAS BEEN AVOIDED. 

 

SPECIAL THANKS TO @AleksiAlkio FOR TAKING EFFORTS

@jaichith Glad you got it figured out! (^_^)

Top Labels in this Space