Forum Discussion

samkamal230's avatar
samkamal230
Regular Visitor
3 years ago

DAX Measure for Showing pages for certain users

Hi Everyone!

I have the following case scenario. I have created a report with several pages (all are hidden except the landing page). The users navigate to other pages via buttons. There are some pages that have charts that drill trhough to other pages (containing sensitive information). I want to hide those pages for all users that are below Managers and Director level employees. 

I thought of creating a button for each of those charts which will only activate when the user logged in has employee status containing Manager or Director. Then that button will drill through to those pages containing sensitive information. 

 

How can I achieve this with the help of DAX? 

3 Replies

  • samkamal230's avatar
    samkamal230
    Regular Visitor

    I have created the following measure, but am unable to navigate to the hidden page "Drill on ABC". 

    Measure =
    IF (
    CONTAINS (
    'User Table',
    'User Table'[Username],
    USERNAME()
    ) && (
    CONTAINS (
    'User Table',
    'User Table'[Job Title],
    "Manager"
    ) || CONTAINS (
    'User Table',
    'User Table'[Job Title],
    "Director"
    )
    ),
    SWITCH ( TRUE(), TRUE(), [Drill on ABC] ),
        BLANK()
    )

    Note: CONTAINSSTRING is not working in this scenario. Also, in the SWITCH statement, it is giving the following error: "Drill on ABC" cannot be determined. Either a column doesn't exist or there is no current row for this column.

    • mlsx4's avatar
      mlsx4
      Icon for Memorable Member rankMemorable Member

      I used this formulas:

      Active user = 
      LOOKUPVALUE( User[Page Id], User[email], USERNAME() )

       

      Control User = 
      VAR __tablaAux = FILTER( User, User[email] = USERNAME() )
      VAR __banderaRol = CONTAINS(__tablaAux, User[Page Id], 2)
      
      Return IF( __banderaRol , "Page1", "Page forbidden" )

      Anyway, you must be aware that this kind of trick is not really safe. User could easily find the "hidden" pages.