Slice, filter or some sort of ref row?

Mike_T
New Member

Iโ€™ve got a dashboard with 2 views: Map of Displays and Campaigns (interactive). Iโ€™m trying to limit which rows the user can see based on their state. Iโ€™ve got a table with a all the users and a column designating their state plus another column tagging them as either a โ€œMโ€ manager or โ€œAโ€ all.

I want the users tagged โ€œAโ€ to see all of the rows on the map. I want the users tagged โ€œMโ€ to only see the rows in the state they are listed in. Whatโ€™s the best way to accomplish this? I have about 7 states so not keen on having 7 slices.

Solved Solved
0 12 460
1 ACCEPTED SOLUTION

I guess I thought that having a formula in a Ref type column would for some reason conflict. You know what they say about โ€œassumingโ€.

I switched the column to Ref and the dashboard is working just fine!

Thanks Steve for busting my myth!

View solution in original post

12 REPLIES 12

Thereโ€™s a few optionsโ€ฆ If you donโ€™t want the โ€œMโ€ users to ever see the other states, then I would put it into a security filterโ€ฆ

Mike_T
New Member

I think I found a very ugly solution so Iโ€™m hoping someone easily smarter than me will graciously reply with a better solution.

I created a slice with the following Row Filter Condition:

IF(LOOKUP(USEREMAIL(),โ€œQRManager Mapโ€,โ€œEmailโ€,โ€œView Typeโ€)=โ€œAโ€,TRUE,IF([State]=LOOKUP(USEREMAIL(), โ€œQRManager Mapโ€, โ€œEmailโ€, โ€œStateโ€),TRUE,FALSE))

Essentially checks for an โ€œAโ€ in the โ€œView Typeโ€ column based on the Useremail matching my QR Manager Table. If this fails then it limits the rows to just the state of the USEREMAIL.

Iโ€™m embarrassed to admit how many hours Iโ€™ve been working on this

Hereโ€™s your expression reformatted to my preference:

IF(
  (
    LOOKUP(
      USEREMAIL(),
      โ€œQRManager Mapโ€,
      โ€œEmailโ€,
      โ€œView Typeโ€
    )
    =โ€œAโ€
  ),
  TRUE,
  IF(
    (
      [State]
      =LOOKUP(
        USEREMAIL(),
        โ€œQRManager Mapโ€,
        โ€œEmailโ€,
        โ€œStateโ€
      )
    ),
    TRUE,
    FALSE
  )
)

Here it is simplified a bit:

OR(
  (
    LOOKUP(
      USEREMAIL(),
      โ€œQRManager Mapโ€,
      โ€œEmailโ€,
      โ€œView Typeโ€
    )
    =โ€œAโ€
  ),
  (
    [State]
    =LOOKUP(
      USEREMAIL(),
      โ€œQRManager Mapโ€,
      โ€œEmailโ€,
      โ€œStateโ€
    )
  )
)

Simplified even further (and more efficient!):

ISNOTBLANK(
  FILTER(
    โ€œQRManager Mapโ€,
    AND(
      ([EMail] = USEREMAIL()),
      OR(
        ([View Type] = "A"),
        ([State] = [_THISROW].[State])
      )
    )
  )
)

Steve,

You are the master of expressions. Wish you could check every expression in my app,

I have new wrinkle. Iโ€™ve recently added some users that cover multiple states. Iโ€™m not sure how to structure the table. If a single user has a row for each state, Iโ€™m pretty sure the Lookup function will find the first instance of USEREMAIL and only slice the corresponding State data. Here is my current working formula:
IF(LOOKUP(USEREMAIL(),โ€œQRManager Mapโ€,โ€œEmailโ€,โ€œView Typeโ€)=โ€œAโ€,TRUE,IF([State]=LOOKUP(USEREMAIL(), โ€œQRManager Mapโ€, โ€œEmailโ€, โ€œStateโ€),TRUE,FALSE))

The multi-state users will still be designated โ€œMโ€ users to restrict their views to only their markets, while โ€œAโ€ users will have access to all. Thanks in advance for your help!

Your expression, reformatted:

IF(
  (
    LOOKUP(
      USEREMAIL(),
      โ€œQRManager Mapโ€,
      โ€œEmailโ€,
      โ€œView Typeโ€
    )
    = โ€œAโ€
  ),
  TRUE,
  IF(
    (
      [State]
      = LOOKUP(
        USEREMAIL(),
        โ€œQRManager Mapโ€,
        โ€œEmailโ€,
        โ€œStateโ€
      )
    ),
    TRUE,
    FALSE
  )
)

Simplified:

OR(
  (
    LOOKUP(
      USEREMAIL(),
      โ€œQRManager Mapโ€,
      โ€œEmailโ€,
      โ€œView Typeโ€
    )
    = โ€œAโ€
  ),
  (
    [State]
    = LOOKUP(
      USEREMAIL(),
      โ€œQRManager Mapโ€,
      โ€œEmailโ€,
      โ€œStateโ€
    )
  )
)

Simplified even further (and more efficient!):

ISNOTBLANK(
  FILTER(
    โ€œQRManager Mapโ€,
    AND(
      ([Email] = USEREMAIL()),
      OR(
        ([View Type] = "A"),
        ([State] = [_THISROW].[State])
      )
    )
  )
)

Which is exactly what I gave you previously.

will this last formula handle my multi-state issue? To confirm, Iโ€™ll need to create a row per state for the same user?

i.e.

Bob M bob@email.com CO
Bob M bob@email.com UT
etc.

@Steve You are a scholar and a gentleman! How can I buy you a beer?!

Mike_T
New Member

The last one ISNOTBLANK doesnโ€™t work for me. Iโ€™ll try the other ones and get back to you. Thanks again for helping out here!

Mike_T
New Member

@Steve Iโ€™m back with a slightly different twist on the Ref_Row Interactive dashboard.

Dashboard has 2 views: 1. Map of Displays from Display Data Table. 2. Table View from Campaign List Table.

Iโ€™m not able to change the Campaign column in the Display Data Table to Ref, because Iโ€™m using a formula in there to select the campaign based on a QRScan in another Form View.

How do I do both?
One view is a dashboard and Iโ€™m trying to use the Campaign column as an interactive filter for a map. Another part of the app in a form view, selects the Campaign based on a Scan column.
Formula in the Display Data Table [Campaign] = LOOKUP([_THISROW].[QR_Code],โ€œQR Codesโ€,โ€œQR_Codeโ€,โ€œCampaignโ€)

In what way doesnโ€™t it work? Screenshots?

I guess I thought that having a formula in a Ref type column would for some reason conflict. You know what they say about โ€œassumingโ€.

I switched the column to Ref and the dashboard is working just fine!

Thanks Steve for busting my myth!

Top Labels in this Space