Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Report Header using DAX

I am hoping this a simple one that I am over thinking...

I have a report that makes use of some dynamic RLS which uses an access table built in to the report that looks like this:

User_EmailUserNameAgentNumCompanyRegionAccess Required
      

 

So what I created a measure that filters the report title to the 'Company' name for a specific user when they log in using the below:

 

Page_Title = IFERROR(IF(CONTAINS(Access_Table,Access_Table[User_Email],USERPRINCIPALNAME())=TRUE(),LOOKUPVALUE(Access_Table[Comapny],Access_Table[User_Email],USERPRINCIPALNAME()),""),"Multiple Selections")

This works fine for 99% of cases, but I have one scenario when there are a number of users who have access to two companies and do not want to see "Multiple Selections" at the top of the report, they want to see the company name.

Example
 
Company
Apple
Apple - Genius Bar


In this scenrio they would want to see 'Apple' at the top. Anybody able to help?

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can try to meet your requirement use following formula:

 

Page_Title =
VAR t =
    FILTER ( Access_Table, [User_Email] = USERPRINCIPALNAME () )
VAR CompanyNumber =
    COUNTROWS ( t )
RETURN
    IF (
        CompanyNumber = 0,
        "",
        IF (
            CompanyNumber = 1,
            MAXX ( t, [Company] ),
            MAXX ( TOPN ( 1, t, [Company], ASC ), [Company] )
        )
    )

 

Or

 

Page_Title =
VAR t =
    FILTER ( Access_Table, [User_Email] = USERPRINCIPALNAME () )
VAR CompanyNumber =
    COUNTROWS ( t )
RETURN
    IF ( CompanyNumber = 0, "", MAXX ( TOPN ( 1, t, [Company], ASC ), [Company] ) )

 

4.PNG

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can try to meet your requirement use following formula:

 

Page_Title =
VAR t =
    FILTER ( Access_Table, [User_Email] = USERPRINCIPALNAME () )
VAR CompanyNumber =
    COUNTROWS ( t )
RETURN
    IF (
        CompanyNumber = 0,
        "",
        IF (
            CompanyNumber = 1,
            MAXX ( t, [Company] ),
            MAXX ( TOPN ( 1, t, [Company], ASC ), [Company] )
        )
    )

 

Or

 

Page_Title =
VAR t =
    FILTER ( Access_Table, [User_Email] = USERPRINCIPALNAME () )
VAR CompanyNumber =
    COUNTROWS ( t )
RETURN
    IF ( CompanyNumber = 0, "", MAXX ( TOPN ( 1, t, [Company], ASC ), [Company] ) )

 

4.PNG

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors