PowerBI Coding

Published
Length
3 min read

Luis Felipe Dias

All posts

You handle powerbi coding by writing data transformation scripts and report calculation formulas. Teams use these two script layers to shape raw tables and build live metrics. Most teams start by linking their reporting app straight to a central database. They often use one shared database login so every report author can build charts. When that shared role has broad read rights, every script can pull private tables. A single formula mistake can expose emails, phone numbers, or card numbers in d

Coding: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You handle powerbi coding by writing data transformation scripts and report calculation formulas. Teams use these two script layers to shape raw tables and build live metrics. Most teams start by linking their reporting app straight to a central database. They often use one shared database login so every report author can build charts. When that shared role has broad read rights, every script can pull private tables. A single formula mistake can expose emails, phone numbers, or card numbers in dashboards.

How powerbi coding works across data and report layers

The platform splits scripting into two separate engines that run at different times. The first engine runs data preparation scripts when the app pulls from a database. Authors use this step to filter rows, join tables, and clean up text columns. These scripts run during scheduled data refreshes or when a user opens a live report. The engine translates those steps into native database queries and sends them over the network.

The second engine runs calculation formulas inside the data model after the data loads. Authors write these formulas to sum revenue, count active users, or compare time periods. Whenever a viewer clicks a chart filter, this engine calculates new numbers right away. Both script types rely on the database credentials saved inside the workspace settings. The database only sees the workspace account, not the person viewing the chart.

How workspace roles control scripts and data refreshes

Admins manage report changes by putting users into workspace roles with fixed rights. Viewers can only open charts and click filters inside the published app. Contributors and members can publish new files, edit scripts, and schedule data refreshes. Teams also set up row-level rules inside the model to filter what viewers see. These rules check the viewer's email address and hide rows from other regions.

During a scheduled refresh, the cloud service logs in to the database using stored keys. If the database sits on a private network, an on-premises connector bridges the traffic. The service runs the data preparation scripts and saves the output into the model. Every user with edit rights in that workspace can reuse that stored database login. They do not need to know the database password to run new queries.

Coding: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native roles solve and where gaps remain

Workspace roles and row filters solve basic report sharing for business viewers. They stop casual readers from editing formulas or downloading the full data file. Still, native settings only decide who can log in and publish to a workspace. They do not inspect what individual database queries do while they run in flight.

Any report author who shares a data source login gets its full database reach. An author can write a custom query that reads raw tables with sensitive columns. If the underlying database role can read national IDs, the script can pull them. Row filters inside the report do not stop the author from pulling raw records first. Audit logs in the database only show the shared service account, not the author. Security teams cannot tell which report writer ran a heavy or risky query. Also, static database keys stored in workspace settings rarely rotate on time. If a contractor leaves the team, rotating that shared key breaks every linked report.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

What are the two main scripting languages used in the platform?

Authors use a query language to pull, filter, and clean raw data during refreshes. They use a separate formula language to build calculated columns and dynamic chart metrics.

Can report authors run custom SQL queries against a connected database?

Yes, authors can paste native SQL statements into the data source step. The query runs with whatever table permissions the saved database login holds.

Why do database logs fail to show which report user ran a query?

Most workspaces connect to databases using one shared service account or static key. The database records that single shared account for every refresh and live query.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.