<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to detect drill mode in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-detect-drill-mode/m-p/5301435#M13221</link>
    <description>&lt;P&gt;Hi Alex, &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/765530"&gt;@alexpokerface&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, you can detect drill mode in custom visuals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How it works:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The Code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Put this inside your `update(options: VisualUpdateOptions)` method:&lt;/P&gt;&lt;P&gt;```typescript&lt;BR /&gt;import { DrillState } from "powerbi-visuals-api";&lt;/P&gt;&lt;P&gt;public update(options: VisualUpdateOptions) {&lt;BR /&gt;const dataView = options.dataViews?.[0];&lt;/P&gt;&lt;P&gt;if (!dataView) return;&lt;/P&gt;&lt;P&gt;const drillState = dataView.metadata?.drillState;&lt;/P&gt;&lt;P&gt;switch(drillState) {&lt;BR /&gt;case DrillState.DrillDown:&lt;BR /&gt;// User clicked Drill Down on a category&lt;BR /&gt;// Example: Year -&amp;gt; Quarter -&amp;gt; Month&lt;BR /&gt;this.renderDrillView(dataView);&lt;BR /&gt;break;&lt;/P&gt;&lt;P&gt;case DrillState.Expand:&lt;BR /&gt;// User clicked + icon to expand tree&lt;BR /&gt;this.renderExpandedView(dataView);&lt;BR /&gt;break;&lt;/P&gt;&lt;P&gt;case DrillState.None:&lt;BR /&gt;default:&lt;BR /&gt;// Normal selection mode&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope you got the answer is any problem you can freely to ask here , Thanks &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jul 2026 02:45:58 GMT</pubDate>
    <dc:creator>Gautam_Kumar01</dc:creator>
    <dc:date>2026-07-17T02:45:58Z</dc:date>
    <item>
      <title>How to detect drill mode</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-detect-drill-mode/m-p/5299636#M13219</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;a quick question:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;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)?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks and kind regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Alex&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2026 09:50:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-detect-drill-mode/m-p/5299636#M13219</guid>
      <dc:creator>alexpokerface</dc:creator>
      <dc:date>2026-07-16T09:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to detect drill mode</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-detect-drill-mode/m-p/5301288#M13220</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/765530"&gt;@alexpokerface&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately there's no simple method to check this. I think the only way to detect this would be to check the &lt;FONT face="courier new,courier"&gt;dataView.metadata&lt;/FONT&gt; for the presence of &lt;A href="https://github.com/microsoft/powerbi-visuals-api/blob/main/src/visuals-api.d.ts#L418" target="_self"&gt;&lt;FONT face="courier new,courier"&gt;drillableRoles&lt;/FONT&gt;&lt;/A&gt;, 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 &lt;FONT face="courier new,courier"&gt;DrillType.Up&lt;/FONT&gt; available on a role, then you are at the top of your hierarchy, and therefore you aren't in a drill state.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/visuals/drilldown-api#example-drilldown-api" target="_self"&gt;The pattern for interrogation of drill state here in the docs&lt;/A&gt; may provide a starting point for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2026 23:42:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-detect-drill-mode/m-p/5301288#M13220</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2026-07-16T23:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to detect drill mode</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-detect-drill-mode/m-p/5301435#M13221</link>
      <description>&lt;P&gt;Hi Alex, &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/765530"&gt;@alexpokerface&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, you can detect drill mode in custom visuals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How it works:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The Code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Put this inside your `update(options: VisualUpdateOptions)` method:&lt;/P&gt;&lt;P&gt;```typescript&lt;BR /&gt;import { DrillState } from "powerbi-visuals-api";&lt;/P&gt;&lt;P&gt;public update(options: VisualUpdateOptions) {&lt;BR /&gt;const dataView = options.dataViews?.[0];&lt;/P&gt;&lt;P&gt;if (!dataView) return;&lt;/P&gt;&lt;P&gt;const drillState = dataView.metadata?.drillState;&lt;/P&gt;&lt;P&gt;switch(drillState) {&lt;BR /&gt;case DrillState.DrillDown:&lt;BR /&gt;// User clicked Drill Down on a category&lt;BR /&gt;// Example: Year -&amp;gt; Quarter -&amp;gt; Month&lt;BR /&gt;this.renderDrillView(dataView);&lt;BR /&gt;break;&lt;/P&gt;&lt;P&gt;case DrillState.Expand:&lt;BR /&gt;// User clicked + icon to expand tree&lt;BR /&gt;this.renderExpandedView(dataView);&lt;BR /&gt;break;&lt;/P&gt;&lt;P&gt;case DrillState.None:&lt;BR /&gt;default:&lt;BR /&gt;// Normal selection mode&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope you got the answer is any problem you can freely to ask here , Thanks &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2026 02:45:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-detect-drill-mode/m-p/5301435#M13221</guid>
      <dc:creator>Gautam_Kumar01</dc:creator>
      <dc:date>2026-07-17T02:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to detect drill mode</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-detect-drill-mode/m-p/5301838#M13222</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2026 06:21:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-detect-drill-mode/m-p/5301838#M13222</guid>
      <dc:creator>alexpokerface</dc:creator>
      <dc:date>2026-07-17T06:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to detect drill mode</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-detect-drill-mode/m-p/5301852#M13223</link>
      <description>&lt;P&gt;Unfortunately that code looks like an hallucination - there's nothing in the APIs matching these types or methods.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2026 06:29:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-detect-drill-mode/m-p/5301852#M13223</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2026-07-17T06:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to detect drill mode</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-detect-drill-mode/m-p/5308111#M13229</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/765530"&gt;@alexpokerface&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;As&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp;said there is no simple straight forward method to check this. However, you can do try the following,&amp;nbsp;all inside&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;update():&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;dataView.metadata.dataRoles.drillableRoles&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;— a map of role name → the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;DrillType[]&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;currently available for it. When&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Drill Up&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is available for a role, the user has drilled down at least one level, which is the reliable "am I in a drilled-down state" signal:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;TypeScript&lt;/SPAN&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;powerbi&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"powerbi-visuals-api"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;
&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;DrillType&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;powerbi&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;DrillType&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;

&lt;SPAN&gt;public&lt;/SPAN&gt; &lt;SPAN&gt;update&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;options&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;powerbi&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;extensibility&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;visual&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;VisualUpdateOptions&lt;/SPAN&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; &lt;/SPAN&gt;&lt;SPAN&gt;void&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;
    &lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;dataRoles&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;options&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;dataViews&lt;/SPAN&gt;&lt;SPAN&gt;?.[&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;]?.&lt;/SPAN&gt;&lt;SPAN&gt;metadata&lt;/SPAN&gt;&lt;SPAN&gt;?.&lt;/SPAN&gt;&lt;SPAN&gt;dataRoles&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;
    &lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;available&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;dataRoles&lt;/SPAN&gt;&lt;SPAN&gt;?.&lt;/SPAN&gt;&lt;SPAN&gt;drillableRoles&lt;/SPAN&gt;&lt;SPAN&gt;?.[&lt;/SPAN&gt;&lt;SPAN&gt;"category"&lt;/SPAN&gt;&lt;SPAN&gt;] &lt;/SPAN&gt;&lt;SPAN&gt;??&lt;/SPAN&gt;&lt;SPAN&gt; []; &lt;/SPAN&gt;&lt;SPAN&gt;// role name from capabilities "drilldown".roles&lt;/SPAN&gt;

    &lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;isDrilledDown&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;available&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;indexOf&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DrillType&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Up&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;;   &lt;/SPAN&gt;&lt;SPAN&gt;// Drill Up exists =&amp;gt; below the top level&lt;/SPAN&gt;
    &lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;canDrillDown&lt;/SPAN&gt;  &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;available&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;indexOf&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DrillType&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Down&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;SPAN&gt;// more levels below&lt;/SPAN&gt;
    &lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;drillDisabled&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;dataRoles&lt;/SPAN&gt;&lt;SPAN&gt;?.&lt;/SPAN&gt;&lt;SPAN&gt;isDrillDisabled&lt;/SPAN&gt; &lt;SPAN&gt;===&lt;/SPAN&gt; &lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;;    &lt;/SPAN&gt;&lt;SPAN&gt;// drilling currently turned off&lt;/SPAN&gt;
&lt;SPAN&gt;}&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;2. &lt;/STRONG&gt;After any drill, Power BI just calls&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;update()&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;again with a new DataView. Read the level from the data — categorical: the number of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;categorical.categories&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and each&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;categories[i].source.displayName&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(e.g., Year → Quarter → Month); matrix: the depth of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;matrix.rows.levels&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and each node's&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;level. Note the category value&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;type&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;can change per level (Date at the top, string lower down), so guard with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;categories[i].source.type&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;before parsing.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3. To drive drilling from your own UX&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(e.g., double-click to drill down), call&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;host.drill(args)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(API 4.7.0+), and optionally&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;host.setCanDrill(true/false)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(5.7.0+) to enable/disable it at runtime.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Good luck,&lt;BR /&gt;Asaf.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;References&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN class=""&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/visuals/drilldown-api" target="_blank" rel="noopener noreferrer"&gt;The Drilldown API in Power BI visuals&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;— documents the exact&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;drillableRoles['...'].indexOf(powerbi.DrillType.Down)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;pattern and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;host.drill()&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class=""&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/visuals/drill-down-support" target="_blank" rel="noopener noreferrer"&gt;Add drill-down support in Power BI visuals&lt;/A&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class=""&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/visuals/dynamic-drill-down" target="_blank" rel="noopener noreferrer"&gt;The dynamic drill-down API in Power BI visuals&lt;/A&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 20 Jul 2026 09:08:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-detect-drill-mode/m-p/5308111#M13229</guid>
      <dc:creator>asafcohen</dc:creator>
      <dc:date>2026-07-20T09:08:57Z</dc:date>
    </item>
  </channel>
</rss>

