<?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: Push dynamic date table using Power BI API in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Push-dynamic-date-table-using-Power-BI-API/m-p/1058589#M23404</link>
    <description>&lt;P&gt;Thank you for your reply&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;! I've accepted your answer as the solution although we know this is not the functionality that we need.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Apr 2020 08:01:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-04-30T08:01:37Z</dc:date>
    <item>
      <title>Push dynamic date table using Power BI API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Push-dynamic-date-table-using-Power-BI-API/m-p/1036817#M23201</link>
      <description>&lt;P&gt;For a project we are pushing data via the Power BI API using the following operations:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/rest/api/power-bi/pushdatasets" target="_blank"&gt;https://docs.microsoft.com/en-us/rest/api/power-bi/pushdatasets&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We would like to use time logic (YTD, Sameperiodlastyear) in our report and we therefor need a 'date table'. See:&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/power-bi/desktop-date-tables" target="_blank"&gt;https://docs.microsoft.com/en-us/power-bi/desktop-date-tables&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The solution we build does not allow us to create a dataset using Power BI desktop so we need to create the dataset using the API.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to create a dynamic date table in a '&lt;SPAN&gt;Push dataset' (a dataset created by the API)? The best way would be to create a calculated table with a DAX statement such as CALENDARAUTO(). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;As a last resort we could push a date table with actual dates in the rows but if possible I want to use a calculated table.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 14:11:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Push-dynamic-date-table-using-Power-BI-API/m-p/1036817#M23201</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-20T14:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Push dynamic date table using Power BI API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Push-dynamic-date-table-using-Power-BI-API/m-p/1038229#M23218</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;HI&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;I don't think it is possible to use Dax functions in power bi rest API. (perhaps you can use the programming language to generate a date table and convert its format and push to the dataset. Notice: this date table need to manually update)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;In my opinion, I'd like to suggest you try to use power bi desktop to create a report with a dynamic calendar table and publish this to power bi service.&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;After these steps, you can use rest api to create new data tables and push data to that dataset.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 05:38:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Push-dynamic-date-table-using-Power-BI-API/m-p/1038229#M23218</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-21T05:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Push dynamic date table using Power BI API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Push-dynamic-date-table-using-Power-BI-API/m-p/1039220#M23229</link>
      <description>&lt;P&gt;Hi &lt;SPAN&gt;@Anonymous&lt;/a&gt;&amp;nbsp;, thanks for the reply. What do you mean by "&lt;/SPAN&gt;&lt;EM&gt;perhaps you can use the programming language to generate a date table and convert its format and push to the dataset&lt;/EM&gt;"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;"I'd like to suggest you try to use power bi desktop to create a report with a dynamic calendar table and publish this to power bi service.&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;After these steps, you can use rest api to create new data tables and push data to that dataset."&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I thought about this but I don't think this is possible. We are creating datasets programmatically based on users that login to an application. The report is cloned based on a report template. We are therefor not able to manually create the date table in Power BI Desktop.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 12:40:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Push-dynamic-date-table-using-Power-BI-API/m-p/1039220#M23229</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-21T12:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Push dynamic date table using Power BI API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Push-dynamic-date-table-using-Power-BI-API/m-p/1052805#M23363</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;HI&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" color="#808080"&gt;&lt;EM&gt;&amp;gt;&amp;gt;What do you mean by "perhaps you can use the programming language to generate a date table and convert its format and push to the dataset"?&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;It means you can create a table based on looping functions(for, while) to generate a calendar table from the start date to end date, then convert this table to correspond push dataset table formula.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" color="#808080"&gt;&lt;EM&gt;&amp;gt;&amp;gt;I thought about this but I don't think this is possible.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;In fact, I double-check on push dataset api and find it only allow you to use on push dataset. For a dataset that publishes from the report, it seems not allow you to works with push dataset rest API.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 07:00:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Push-dynamic-date-table-using-Power-BI-API/m-p/1052805#M23363</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-28T07:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Push dynamic date table using Power BI API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Push-dynamic-date-table-using-Power-BI-API/m-p/1056981#M23389</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Yep this is a royale pain in the neck. The Push DataSet does not appear to be able to apply a "IsDateTable" attribute to a dataset.&lt;/P&gt;&lt;P&gt;I also tried to use Measures to create the colums, using CALENDARAUTO() howver, this does not appear to work either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a hack solution for this, I generate a table using the API, then simply generate the columns in code: ex: In fact, even more is broken, as you cannot "sort" a visual by a non-visual column, as is often required for Month, or other Alpha fields, as the default sort is Alph ion the visual. Sure would like for this to work a bit better.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you cant designate a table as a "Special Date Table", you have to explicitly add a relationship to the Date and cols.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Simple hack code:&lt;/P&gt;&lt;P&gt;var dataRowsReq = new PostRowsRequest();&lt;/P&gt;&lt;P&gt;// PSH - Because I cant get CALENDARAUTO() DAX to work, gonna generate them here...&lt;BR /&gt;int monthIdx = 0;&lt;BR /&gt;int quarterIdx = 0;&lt;BR /&gt;var calPrev = new CalendarPbi();&lt;BR /&gt;var dateStart = new DateTime(2015, 1, 1);&lt;BR /&gt;var dateEnd = new DateTime(2021, 12, 31);&lt;BR /&gt;var dates = new List&amp;lt;CalendarPbi&amp;gt;();&lt;BR /&gt;for (var dt = dateStart; dt &amp;lt;= dateEnd; dt = dt.AddDays(1))&lt;BR /&gt;{&lt;BR /&gt;var cal = new CalendarPbi();&lt;BR /&gt;cal.Date = dt.ToString("MM/dd/yyyy");&lt;BR /&gt;cal.Year = String.Format ("CY {0:yyyy}", dt);&lt;BR /&gt;cal.Month = String.Format("{0:yyyy MM}", dt); // PBI BrainDead - Need to sort here...&lt;BR /&gt;cal.Quarter = String.Format("{0:yyyy} Q{1}", dt, ((dt.Month + 2) / 3));&lt;/P&gt;&lt;P&gt;// Sort Idxss...&lt;BR /&gt;if (cal.Month != calPrev.Month)&lt;BR /&gt;{&lt;BR /&gt;monthIdx++;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;if (cal.Quarter != calPrev.Quarter)&lt;BR /&gt;{&lt;BR /&gt;quarterIdx++;&lt;BR /&gt;}&lt;BR /&gt;cal.MonthIdx = monthIdx;&lt;BR /&gt;cal.QuarterIdx = quarterIdx;&lt;/P&gt;&lt;P&gt;dates.Add(cal);&lt;BR /&gt;calPrev = cal;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Paginate load into PowerBI...&lt;BR /&gt;var inc = 10000;&lt;BR /&gt;var skip = 0;&lt;BR /&gt;var cnt = 0;&lt;BR /&gt;while (cnt &amp;lt; dates.Count())&lt;BR /&gt;{&lt;BR /&gt;dataRowsReq.Rows = dates.Skip(skip).Take(inc).Cast&amp;lt;Object&amp;gt;().ToList();&lt;BR /&gt;client.Datasets.PostRowsInGroup(workspaceId, datasetId, TABLE_NAME_CALENDAR, dataRowsReq);&lt;/P&gt;&lt;P&gt;cnt += inc;&lt;BR /&gt;skip += inc;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 15:41:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Push-dynamic-date-table-using-Power-BI-API/m-p/1056981#M23389</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-29T15:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: Push dynamic date table using Power BI API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Push-dynamic-date-table-using-Power-BI-API/m-p/1058589#M23404</link>
      <description>&lt;P&gt;Thank you for your reply&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;! I've accepted your answer as the solution although we know this is not the functionality that we need.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 08:01:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Push-dynamic-date-table-using-Power-BI-API/m-p/1058589#M23404</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-30T08:01:37Z</dc:date>
    </item>
  </channel>
</rss>

