<?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: Help with filtering the KnowBe4 &amp;quot;training/enrollments API endpoint in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Help-with-filtering-the-KnowBe4-quot-training-enrollments-API/m-p/4767853#M62264</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/798467"&gt;@foxyox&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for reaching out to the Microsoft Community Forum.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are trying to filter the KnowBe4 training/enrollments API endpoint to only retrieve data from the last 90 days based on the enrollment_date field, but the official documentation does not mention support for such filtering directly in the API request URL. Since the API doesn’t support filtering by enrollment_date on the server side.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of trying to filter in the API call, continue fetching all pages, but filter the data in Power Query after import to only keep rows from the past 90 days.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer below M code to filter the data from the past 90 days.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;let&lt;BR /&gt;Source = List.Numbers(1, 10000, 1),&lt;BR /&gt;PageTable = Table.FromList(Source, Splitter.SplitByNothing(), {"PageNumber"}),&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;AddApiCall = Table.AddColumn(PageTable, "ApiResponse", each &lt;BR /&gt;Json.Document(&lt;BR /&gt;Web.Contents(&lt;BR /&gt;"&lt;A href="https://eu.api.knowbe4.com/v1" target="_blank"&gt;https://eu.api.knowbe4.com/v1&lt;/A&gt;",&lt;BR /&gt;[&lt;BR /&gt;RelativePath = "training/enrollments?page=" &amp;amp; Text.From([PageNumber]) &amp;amp; "&amp;amp;per_page=500",&lt;BR /&gt;Timeout = #duration(0, 16, 40, 0),&lt;BR /&gt;Headers = [Authorization = "Bearer &amp;lt;redacted&amp;gt;"]&lt;BR /&gt;]&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;),&lt;/P&gt;
&lt;P&gt;ExpandEnrollments = Table.ExpandListColumn(AddApiCall, "ApiResponse"),&lt;BR /&gt;ExpandRecords = Table.ExpandRecordColumn(ExpandEnrollments, "ApiResponse", {&lt;BR /&gt;"enrollment_id", "content_type", "module_name", "user", "campaign_name", &lt;BR /&gt;"enrollment_date", "start_date", "completion_date", "status", "time_spent", &lt;BR /&gt;"policy_acknowledged", "score"&lt;BR /&gt;}),&lt;/P&gt;
&lt;P&gt;ExpandUser = Table.ExpandRecordColumn(ExpandRecords, "user", {"id", "first_name", "last_name", "email"}, {"user_id", "first_name", "last_name", "email"}),&lt;BR /&gt;&lt;BR /&gt;ChangeTypes = Table.TransformColumnTypes(ExpandUser, {&lt;BR /&gt;{"enrollment_date", type datetime},&lt;BR /&gt;{"start_date", type datetime},&lt;BR /&gt;{"completion_date", type datetime},&lt;BR /&gt;{"time_spent", type number}&lt;BR /&gt;}),&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;FilterRecent = Table.SelectRows(ChangeTypes, each [enrollment_date] &amp;gt;= DateTime.LocalNow() - #duration(90, 0, 0, 0))&lt;BR /&gt;&lt;BR /&gt;in&lt;BR /&gt;FilterRecent&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this information helps. Please do let us know if you have any further queries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Dinesh&lt;/P&gt;</description>
    <pubDate>Fri, 18 Jul 2025 06:32:56 GMT</pubDate>
    <dc:creator>v-dineshya</dc:creator>
    <dc:date>2025-07-18T06:32:56Z</dc:date>
    <item>
      <title>Help with filtering the KnowBe4 "training/enrollments API endpoint</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-with-filtering-the-KnowBe4-quot-training-enrollments-API/m-p/4767044#M62255</link>
      <description>&lt;P&gt;I am pretty new the "API" side of PowerBI, although have extensive experience in transforming data and building reports once they have been setup.&lt;BR /&gt;&lt;BR /&gt;I am attempting to build a data model which includes data from this endpoint: "&lt;A href="https://eu.api.knowbe4.com/v1/training/enrollments" target="_blank" rel="noopener"&gt;https://eu.api.knowbe4.com/v1/training/enrollments&lt;/A&gt;"&lt;BR /&gt;&lt;BR /&gt;Without any API filters applied it takes a long time to pull back this data into PowerBI - but we only really need data where the [enrollment_date] parameter is within the last 90 days.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The KnowBe4 API documentation does not state that you can apply this particular filter to the request, so I am asking here in case anyone has achieved this or similar. Link to the documentation for this endpoint:&amp;nbsp;&lt;A href="https://developer.knowbe4.com/rest/reporting#tag/Training/paths/~1v1~1training~1enrollments/get" target="_blank" rel="noopener"&gt;https://developer.knowbe4.com/rest/reporting#tag/Training/paths/~1v1~1training~1enrollments/get&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This is my query code currently, which I trial and errored to get working from a previous post from the users endpoint, and how to paginate successfully&lt;BR /&gt;&lt;BR /&gt;let&lt;BR /&gt;Source = List.Numbers(1,10000,1),&lt;BR /&gt;#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),&lt;BR /&gt;#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type text}}),&lt;BR /&gt;#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each&lt;BR /&gt;Json.Document(&lt;BR /&gt;Web.Contents(&lt;BR /&gt;"&lt;A href="https://eu.api.knowbe4.com/v1" target="_blank" rel="noopener"&gt;https://eu.api.knowbe4.com/v1&lt;/A&gt;",&lt;BR /&gt;[&lt;BR /&gt;RelativePath= "training/enrollments?page="&amp;amp; [Column1] &amp;amp; "&amp;amp;per_page=500",&lt;BR /&gt;Timeout=#duration(0, 16, 40, 0),&lt;BR /&gt;Headers=[Authorization="Bearer &amp;lt;redacted&amp;gt;"]&lt;BR /&gt;]&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),&lt;BR /&gt;#"Expanded Custom1" = Table.ExpandRecordColumn(#"Expanded Custom", "Custom", {"enrollment_id", "content_type", "module_name", "user", "campaign_name", "enrollment_date", "start_date", "completion_date", "status", "time_spent", "policy_acknowledged", "score"}, {"enrollment_id", "content_type", "module_name", "user", "campaign_name", "enrollment_date", "start_date", "completion_date", "status", "time_spent", "policy_acknowledged", "score"}),&lt;BR /&gt;#"Expanded user" = Table.ExpandRecordColumn(#"Expanded Custom1", "user", {"id", "first_name", "last_name", "email"}, {"id", "first_name", "last_name", "email"}),&lt;BR /&gt;#"Changed Type1" = Table.TransformColumnTypes(#"Expanded user",{{"enrollment_date", type datetime}, {"start_date", type datetime}, {"completion_date", type datetime}, {"time_spent", type number}})&lt;BR /&gt;in&lt;BR /&gt;#"Changed Type1"&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2025 13:22:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-with-filtering-the-KnowBe4-quot-training-enrollments-API/m-p/4767044#M62255</guid>
      <dc:creator>foxyox</dc:creator>
      <dc:date>2025-07-17T13:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help with filtering the KnowBe4 "training/enrollments API endpoint</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-with-filtering-the-KnowBe4-quot-training-enrollments-API/m-p/4767232#M62259</link>
      <description>&lt;P&gt;It might be worth asking the KnowBe4&amp;nbsp; support if they can add that filter to their API.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2025 15:36:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-with-filtering-the-KnowBe4-quot-training-enrollments-API/m-p/4767232#M62259</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-07-17T15:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help with filtering the KnowBe4 "training/enrollments API endpoint</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-with-filtering-the-KnowBe4-quot-training-enrollments-API/m-p/4767853#M62264</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/798467"&gt;@foxyox&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for reaching out to the Microsoft Community Forum.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are trying to filter the KnowBe4 training/enrollments API endpoint to only retrieve data from the last 90 days based on the enrollment_date field, but the official documentation does not mention support for such filtering directly in the API request URL. Since the API doesn’t support filtering by enrollment_date on the server side.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of trying to filter in the API call, continue fetching all pages, but filter the data in Power Query after import to only keep rows from the past 90 days.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer below M code to filter the data from the past 90 days.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;let&lt;BR /&gt;Source = List.Numbers(1, 10000, 1),&lt;BR /&gt;PageTable = Table.FromList(Source, Splitter.SplitByNothing(), {"PageNumber"}),&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;AddApiCall = Table.AddColumn(PageTable, "ApiResponse", each &lt;BR /&gt;Json.Document(&lt;BR /&gt;Web.Contents(&lt;BR /&gt;"&lt;A href="https://eu.api.knowbe4.com/v1" target="_blank"&gt;https://eu.api.knowbe4.com/v1&lt;/A&gt;",&lt;BR /&gt;[&lt;BR /&gt;RelativePath = "training/enrollments?page=" &amp;amp; Text.From([PageNumber]) &amp;amp; "&amp;amp;per_page=500",&lt;BR /&gt;Timeout = #duration(0, 16, 40, 0),&lt;BR /&gt;Headers = [Authorization = "Bearer &amp;lt;redacted&amp;gt;"]&lt;BR /&gt;]&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;),&lt;/P&gt;
&lt;P&gt;ExpandEnrollments = Table.ExpandListColumn(AddApiCall, "ApiResponse"),&lt;BR /&gt;ExpandRecords = Table.ExpandRecordColumn(ExpandEnrollments, "ApiResponse", {&lt;BR /&gt;"enrollment_id", "content_type", "module_name", "user", "campaign_name", &lt;BR /&gt;"enrollment_date", "start_date", "completion_date", "status", "time_spent", &lt;BR /&gt;"policy_acknowledged", "score"&lt;BR /&gt;}),&lt;/P&gt;
&lt;P&gt;ExpandUser = Table.ExpandRecordColumn(ExpandRecords, "user", {"id", "first_name", "last_name", "email"}, {"user_id", "first_name", "last_name", "email"}),&lt;BR /&gt;&lt;BR /&gt;ChangeTypes = Table.TransformColumnTypes(ExpandUser, {&lt;BR /&gt;{"enrollment_date", type datetime},&lt;BR /&gt;{"start_date", type datetime},&lt;BR /&gt;{"completion_date", type datetime},&lt;BR /&gt;{"time_spent", type number}&lt;BR /&gt;}),&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;FilterRecent = Table.SelectRows(ChangeTypes, each [enrollment_date] &amp;gt;= DateTime.LocalNow() - #duration(90, 0, 0, 0))&lt;BR /&gt;&lt;BR /&gt;in&lt;BR /&gt;FilterRecent&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this information helps. Please do let us know if you have any further queries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Dinesh&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2025 06:32:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-with-filtering-the-KnowBe4-quot-training-enrollments-API/m-p/4767853#M62264</guid>
      <dc:creator>v-dineshya</dc:creator>
      <dc:date>2025-07-18T06:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help with filtering the KnowBe4 "training/enrollments API endpoint</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-with-filtering-the-KnowBe4-quot-training-enrollments-API/m-p/4768494#M62277</link>
      <description>&lt;P&gt;Thank you, I think this is the best outome considering the lack of filterability on the API endpoint - whilst it may not help with the data refresh time, it certainly keeps the report smaller and more usable.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2025 12:34:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-with-filtering-the-KnowBe4-quot-training-enrollments-API/m-p/4768494#M62277</guid>
      <dc:creator>foxyox</dc:creator>
      <dc:date>2025-07-18T12:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help with filtering the KnowBe4 "training/enrollments API endpoint</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-with-filtering-the-KnowBe4-quot-training-enrollments-API/m-p/4768500#M62278</link>
      <description>&lt;P&gt;Thanks, I raised with them at the same time as posting this, they said the reporting API was not filterable in this way but their graph API endpoint was,&amp;nbsp;&lt;A href="https://developer.knowbe4.com/graphql/ksat/query/enrollments" target="_blank"&gt;https://developer.knowbe4.com/graphql/ksat/query/enrollments&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;So I need to look at this next. Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2025 12:36:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-with-filtering-the-KnowBe4-quot-training-enrollments-API/m-p/4768500#M62278</guid>
      <dc:creator>foxyox</dc:creator>
      <dc:date>2025-07-18T12:36:20Z</dc:date>
    </item>
  </channel>
</rss>

