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.






