Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

REST API PushDataSet Date Table Measures

Hi,

I am working thru using PushDatasets for an Embedded solution. It looks promising. 

However, I am really struggling with Measures, and in particular building a Date table.

 

This is the guts of the problematic code, resulting in an "InternalServerError" after a lengthy time. I have tried all sorts of variants, some resulting in BadRequest, and others in the InternalServer error. I dont seem to be able to find any concrete examples

 

Code:

// Columns...
var datecolList = new List<Column>();
datecolList.Add(new Column("Date", "datetime"));
datecolList.Add(new Column("Year", "string"));
datecolList.Add(new Column("Quarter", "string"));
datecolList.Add(new Column("Month", "string"));

// Date measure...
var dateMeasureList = new List<Measure>();
Measure meas1 = new Measure();
meas1.Name = "Date";
meas1.Expression = "Date = CALENDARAUTO()";
dateMeasureList.Add(meas1);

// OK - This expression is breaking the dataset creation. Commented out....
Measure meas2 = new Measure();
meas2.Name = "Year";
meas2.Expression = @"Year = ""CY"" & FORMAT([Date], ""yyyy"")";

dateMeasureList.Add(meas2);

tableDate = new Table("Date", datecolList, null, dateMeasureList);

 

The exception occurs in the 

dataset = client.Datasets.PostDatasetInGroup(workspaceId, datasetReq, DefaultRetentionPolicy.BasicFIFO);

 

I have a number of other tables that Schema define and load data just fine. Its just this Date table with the measures that blowup with less than helpful exceptions.

 

Does any one have a sample ? or suggestions ?

 

 

 

1 REPLY 1
Greg_Deckler
Super User
Super User

You could check the Issues forum here:

https://community.powerbi.com/t5/Issues/idb-p/Issues

And if it is not there, then you could post it.

If you have Pro account you could try to open a support ticket. If you have a Pro account it is free. Go to https://support.powerbi.com. Scroll down and click "CREATE SUPPORT TICKET".


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.