Adding a Password Box to a Power BI report

Adding a Password Box to a Power BI report

Here’s a process that allows you to add a password input box to your Power BI report.

DO NOT, I repeat DO NOT use this for sensitive data.  I have no idea if there are ways to hack this but it’s just an interesting exercise in using some features in Power BI. This is not to be used as a substitute for proper security. See my warning at the end.

The concept

Once you can capture a name and password you can give access to otherwise hidden pages or even set certain measures to zero by multiplying by zero if the password isn't correct.

The end result

This is what the user would see when they open the report

No alt text provided for this image

I’ve published the report here for you to try it out

(click the Show Passwords button to see the user names and passwords to try out)


After clicking the login button 2 Text boxes are shown 

No alt text provided for this image

The Text boxes are actually the Text Filter custom visual from the marketplace

No alt text provided for this image

The first text filter requires the user’s name and the 2nd requires their password.

After entering the correct user name and password a single button appears (actually it’s a pie chart with the number 1 as a value) which enables the user to then drill-through to the main report

No alt text provided for this image

Navigation through the “hidden” part of the report is then driven by buttons and bookmarks.


How to set it up

This is how I initially set up the User and Password table.

Table Name: USER LOGIN

No alt text provided for this image

(I just used Enter Data to set this up)

Then reference that query and remove the User column to just give you a password table

Table Name: USER PASSWORD

No alt text provided for this image

I also added a table called PieChartLabel for the “button” label to prompt the drill through

No alt text provided for this image

These all get loaded as disconnected tables

Now we move back to the text filter custom visuals…

No alt text provided for this image

The first one is set with the User Column from the User Login Table

The second search box references the Password column from the User Password Table

Time for 4 measures

Firstly, we need 2 measures to “harvest” the values entered in the search boxes

User Entered = SELECTEDVALUE ( 'User Login'[User], “No User” )

Note: the search box is filtering this table leaving just the one name in the table

Password Entered = SELECTEDVALUE ( 'User Password'[Password], “No Password” )

Note: the search box is filtering this table leaving just the one password in the table


We then need a measure to get the Password that was required for that User and see if it matches the password entered.

Password Required =

LOOKUPVALUE (

   'User Login'[Password],

   'User Login'[User], [User Entered]

)

The last measure needed generates a value of 1 (True) if the [Password Entered] = [Password Required]

Password Control =

IF (

    OR ( 

[Password Entered]=BLANK (),

[Password Entered] <> [Password Required] 

    ),

    0,

    1

)

Then we can use this Password Control measure in pie chart along with a label from the Entry table

No alt text provided for this image


THE END RESULT / TRICK

The result of this is if the password entered doesn’t match the expected password then the measure results in the value 0 and the Pie Chart visual will not display the drill-through option

Once the drill-through option is available then you have full access to the report via buttons and bookmarks.


****Not quite the whole story – KEEP READING!!!!****

On the face of it appeared to work.

On testing I realised that if the customer name is entered then as soon as you enter the first letter of the password the screen unlocks. This is due to the nature of using the search box, it filters the table with all words beginning with what you are typing.

So a little rework is required….

I used Power Query to append a duplicate set of customer data with passwords but removing the last letter of both the customer name and the password for the duplicate part.

each Text.Start([User],Text.Length([User])-1)

No alt text provided for this image

This way, when the customer name and password are being typed into the search boxes the full name and full password must be entered before the search box returns a single record for customer and single record for password.

Then it works well.

BE WARNED

Just like password protection inside Excel this is not a process to rely on for proper protection.  The Password you type in is obvious to anyone looking over your shoulder and it’s probably easy to hack this, so please don’t rely on it for anything important!

Read about proper ROW LEVEL SECURITY if you really want a robust solution to limit the data that users can access.


Wyn

No alt text provided for this image


accessanalytic.com.au/blog
Amira Bedhiafi

Data Witch | Microsoft MVP Data Platform | Microsoft MVP Power BI | Power BI Super User | C# Corner MVP | Full Stack Business Intelligence Engineer

1 年

While the concept of adding a password box to a Power BI report is interesting and may seem to provide an additional layer of security, I find myself questioning the utility and effectiveness of this approach. Power BI already provides robust security and access controls that can be managed at the organization level.? Incorporating a password box within a report could introduce complexities related to password management and increase the risk of unauthorized access if not implemented securely. Furthermore, embedding security within the report itself might conflict with existing permissions or create a disjointed user experience. Could you please elaborate on the specific use case for this password box? Understanding the scenario you're trying to address might help readers, including myself, to appreciate the potential benefits of this method, as well as weigh the potential risks and challenges. It would be valuable to know how this approach aligns with best practices for data security and what problem it is designed to solve within the context of Power BI. In a simpler way, is Power BI really made for this ? I still receive many requests from many stackholders to have reports behaving like HTML pages. Thank you.

回复
Mina Mishail

Data & Business Analyst | BI | ETL | Database Management | Reporting & Data Modeling

2 年

how can I refresh a "Query" of power query in an Excel file?based on another password-protected Excel file without opening a protected Excel file each time? I already have the protection password. Is there a way to pass the password as a variable value or a similar way?

回复
Frank H.

Solutions Architect/Data Scientist/AI Engineer/Data Engineer/BI Analyst

3 年

Very creative way, could be useful if we want to set up specific permission groups with in the same APP workspace. ??

回复
Nupur Bishnoi

Microsoft certified Power BI report and dashboard developer, MSTR, SSRS, SQL

4 年

Hi Wyn, I want to download this file and found out that the link had expired, could you please post a link to download the Pbix. Thanks...

回复
Sonam Pillai

Assitant Manager - IT @ Pidilite Industries |MICROSOFT CERTIFIED | Power BI | SQL | Advance Excel | DATA VISUALIZATION

4 年

Hi Wyn, thank you for this very helpful and very innovative idea.

要查看或添加评论,请登录

Wyn Hopkins的更多文章

  • PowerToys

    PowerToys

    PowerToys is one of the most underrated free tools available for Windows users. Developed by Microsoft, this suite of…

    3 条评论
  • The Best Dependent Drop Down Technique

    The Best Dependent Drop Down Technique

    Driven by a gauntlet laid down by friend and fellow MVP Mark Proctor on our Unpivot podcast recently I revisited my…

    1 条评论
  • Should you use Measures for Conditional Formatting?

    Should you use Measures for Conditional Formatting?

    Streamline Your Power BI Conditional Formatting with Measures I've always found the built-in conditional formatting in…

    6 条评论
  • Consolidate and Hyperlink to Excel files on SharePoint

    Consolidate and Hyperlink to Excel files on SharePoint

    In this video, we're diving into the world of Excel and Power BI, focusing on creating hyperlinks for easy referencing…

    4 条评论
  • The greatest multi-level Excel drop-down list ever!

    The greatest multi-level Excel drop-down list ever!

    One-Off dependent drop down lists in data validation are relatively straightforward: here's a technique using XLOOKUP…

    5 条评论
  • Default Your Slicer to the Current Month in Power BI

    Default Your Slicer to the Current Month in Power BI

    First Published November 2022 on our YouTube Channel Join 65,000+ subscribers to stay up to date with new videos…

    4 条评论
  • Power BI Licensing Explained

    Power BI Licensing Explained

    What are the differences between: Power BI Free (soon to be renamed Fabric Free) Pro: $10 USD pp/pm PPU (Premium Per…

    2 条评论
  • Power BI May 2023 Release

    Power BI May 2023 Release

    The May version of Power BI desktop is out This is a very quick post highlighting my 2 favourite picks: 1. Azure Maps…

    5 条评论
  • Simpler DAX ? = Power Query

    Simpler DAX ? = Power Query

    If you are struggling to write a complicated DAX formula then the answer may be to step back and do a little Power…

    2 条评论
  • Power BI Explained

    Power BI Explained

    A simple explanation of Power BI I hope you find this useful. Power BI continues to go from strength to strength and…

社区洞察

其他会员也浏览了