Weโve created a step-by-step walkthrough video that demonstrates the entire setup in real-time.
๐ Watch it on YouTube โ JBSWiki Channel
Controlling Power BI report access based on time is an essential feature for organizations with time-bound reporting requirements, compliance restrictions, or business-specific policies. In this blog post, we will walk through a real-world use case where we use Power Apps to embed a Power BI report and restrict its access based on a specific time window (9:00 AM to 1:00 PM).
This solution is simple, clean, and effectiveโand uses only native capabilities in Power Apps, without needing advanced permissions or complex security configurations.
Letโs dive in!
โ Why Time-Based Access?
There are several scenarios where restricting Power BI report access by time makes sense:
- ๐ Business Hours Only Access: You want employees to view reports only during operational hours.
- ๐ Security Compliance: You need to control access windows for sensitive reports.
- ๐ Scheduled Refresh Windows: Prevent access during report refresh to avoid outdated data usage.
Rather than configuring complex access rules at the Power BI service level, Power Apps gives you flexibility to embed the report conditionally, based on the system time and logic defined in your app.
๐งฐ What You’ll Need
- Microsoft Power Apps license
- A published Power BI report
- The iFrame URL of the Power BI report (embed link)
- Basic familiarity with Power FX, HTML Text Control, and variables in Power Apps
๐ง Step-by-Step Implementation
1. ๐ฏ Define the Time-Based Logic
Weโll use a button in Power Apps that sets the current time into variables and checks if the time falls between 9:00 AM and 1:00 PM. If yes, it launches the Power BI report; otherwise, it shows an Access Denied notification.
๐น Code for the Button in Power Apps:
Set(varNow, Now());
Set(varHour, Hour(varNow));
Set(varMinute, Minute(varNow));
Set(varCurrentTime, Time(varHour, varMinute, 0));
Set(varAccessAllowed, varCurrentTime >= Time(9, 0, 0) && varCurrentTime < Time(13, 0, 0));
If(
varAccessAllowed,
Launch("https://app.powerbi.com/reportEmbed?reportId=fc00e03c-ec12-4038-af5a-2bfb9972f70b&autoAuth=true"),
Notify("Access denied. You are allowed to view this report between 9:00 - 13:00.", NotificationType.Error)
)
๐ก Explanation:
varNow: Captures the current system timestamp.varHour&varMinute: Extracts the hour and minute.varCurrentTime: Combines hour and minute into aTimeobject.varAccessAllowed: Boolean flag based on whether the current time is between 9:00 AM and 1:00 PM.If(...): Launches the Power BI report if access is allowed; otherwise, shows an error notification.
2. ๐ Display Time and Access Status
Add a Text Label to show the current time and whether access is allowed. This helps with testing and gives users clarity.
๐น Code for the Text Label:
"Now: " & Text(Now(), "[$-en-US]HH:mm:ss") &
" | Allowed: " & Text(varAccessAllowed)
This will dynamically update and display:
- Current time
- Whether access is currently allowed
Example output:Now: 10:45:23 | Allowed: true
๐ Real-World Use Cases
Here are a few scenarios where this logic is useful:
| Scenario | Benefit |
|---|---|
| ๐ Internal Dashboards | Restrict to working hours only |
| ๐ฆ Banking/Finance Apps | Limit sensitive data views during authorized hours |
| ๐งพ Compliance & Audits | Enforce strict access rules using app logic |
| ๐ข Client-Specific Reports | Tailor access hours based on agreements |
๐ Why Use Power Apps for This?
โ
Flexible Control: No need to alter Power BI permissions
โ
Low-Code Friendly: Easy to maintain and update
โ
Secure Embedding: iFrame loads only after validation
โ
User Feedback: Display live status and messages using simple UI elements
๐ Tips and Best Practices
- ๐ Always use 24-hour format when working with
Time()in Power FX - ๐ Do not expose sensitive logic in client-side apps unless supported by security measures
- ๐ Consider refreshing the time variables periodically if embedding directly in app screens
- ๐ผ๏ธ Use a Gallery or Container if embedding multiple reports with different rules
๐ฅ Watch the Video
Weโve created a step-by-step walkthrough video that demonstrates the entire setup in real-time.
๐ Watch it on YouTube โ JBSWiki Channel
๐ Conclusion
Using Power Apps + Power BI, you can securely control report visibility based on custom business logic. This time-based control pattern is just one of many ways to extend app capabilities using simple Power FX expressions.
With this setup:
- Your users see reports only when theyโre supposed to
- Your data remains protected
- Your app feels responsive and intelligent
Thank You,
Vivek Janakiraman
Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided โAS ISโ with no warranties, and confers no rights.
- access control using power apps
- access denied message in power apps
- advanced power apps tutorial
- azure power bi embed best practices
- azure power platform tutorial
- azure series power bi
- business app with power bi
- business hours power bi access
- conditional html power apps
- conditional iframe embed
- conditional logic in power apps
- conditionally launch report
- control power bi access in power apps
- current time in power fx
- dynamic power bi embedding
- dynamic report viewing power apps
- embed analytics in power apps
- embed bi dashboards in apps
- Embed Power BI in Power Apps
- embed power bi only when allowed
- embed power bi using html
- embed power bi with time range
- embed power bi without premium
- embed report in html text control
- embed report with time check
- embed secure power bi dashboard
- hide power bi outside time
- hide report with access logic
- html code in power apps
- html iframe power bi
- launch url in power apps
- low code app with power bi
- low code power bi integration
- microsoft apps integration
- microsoft power apps example
- microsoft power platform tutorial
- no access power bi message
- Power Apps Conditional Logic
- power apps dynamic report access
- power apps embed report securely
- power apps for developers
- power apps html text control
- power apps if condition
- power apps if else logic
- power apps notification example
- power apps power bi integration
- power apps power fx tutorial
- power apps set variables
- power apps show report conditionally
- power apps time based logic
- power apps time condition
- power apps use now function
- power bi access control logic
- Power BI Access Hours
- power bi and azure integration
- power bi and power apps security
- power bi conditional access
- power bi custom embedding
- power bi custom report viewer
- power bi dynamic launch
- power bi embed portal
- power bi embed url
- Power BI iFrame Embed
- power bi in iframe
- Power BI in Power Apps HTML Control
- power bi inside apps
- power bi logic in power apps
- Power BI Power Apps Integration
- power bi real world demo
- power bi report embed example
- power bi report in power apps
- Power BI Report Restriction
- power bi report with logic
- power bi reporting security
- power bi show access denied
- power bi time based access
- power bi with conditional access
- power bi with power fx
- power bi working hours access
- power fx conditional launch
- power fx embed report
- power fx time condition
- Power FX Time Control
- Power Platform Use Cases
- real time logic power apps
- real time validation power apps
- report viewer in power apps
- restrict power bi viewing
- restrict user access power bi
- Secure BI Access
- secure dashboard embedding
- secure iframe in power apps
- secure power bi report embed
- secure power bi url
- set variable in power fx
- show or hide report power apps
- time based security power bi
- time check logic power apps
- time logic in power apps
- time restricted dashboard power apps
- time restricted power bi report
- Time-Based Power BI Access
- using now function in power apps
- weekday logic in power apps
- working hour access control power apps