Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hi,
a quick question:
In the Power BI custom visuals API, is there any way to detect whether the visual is currently in drill mode (as opposed to normal selection mode)?
Thanks and kind regards,
Alex
Hi Alex, @alexpokerface
Yes, you can detect drill mode in custom visuals.
How it works:
When a user clicks "Drill Down" in Power BI, the visual gets a new update call. In that update, Power BI tells your visual what mode it's currently in through the DataView metadata.
The Code:
Put this inside your `update(options: VisualUpdateOptions)` method:
```typescript
import { DrillState } from "powerbi-visuals-api";
public update(options: VisualUpdateOptions) {
const dataView = options.dataViews?.[0];
if (!dataView) return;
const drillState = dataView.metadata?.drillState;
switch(drillState) {
case DrillState.DrillDown:
// User clicked Drill Down on a category
// Example: Year -> Quarter -> Month
this.renderDrillView(dataView);
break;
case DrillState.Expand:
// User clicked + icon to expand tree
this.renderExpandedView(dataView);
break;
case DrillState.None:
default:
// Normal selection mode
I hope you got the answer is any problem you can freely to ask here , Thanks 😊
Thanks for the snippet! I checked the current and recent versions of the powerbi-visuals-api, and neither DrillState nor dataView.metadata.drillState exists in the public API. If this comes from an internal or experimental build, that would be interesting — but in the official contract, the property isn’t available.
Unfortunately that code looks like an hallucination - there's nothing in the APIs matching these types or methods.
Proud to be a Super User!
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Hi @alexpokerface,
Unfortunately there's no simple method to check this. I think the only way to detect this would be to check the dataView.metadata for the presence of drillableRoles, and perhaps, based on your knowledge of your setup, whether the resulting state means you're somewhere in the hierarchy (e.g, if there's no DrillType.Up available on a role, then you are at the top of your hierarchy, and therefore you aren't in a drill state.
The pattern for interrogation of drill state here in the docs may provide a starting point for you.
Good luck,
Daniel
Proud to be a Super User!
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.