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
Daniel1
Regular Visitor

Error free measure from Power BI Desktop returns an error after publishing

Hi all,

I created my first dashboard in Power BI desktop and everything was working fine. After publishing the dashboard to power BI online one of my measures returns an error.

 

Measure: YTD2017 = CALCULATE(SUM(APEWeekly[GAP CZK]); DATESBETWEEN(DateDimension[DateKey];"27.12.2016";LASTDATE(DateDimension[DateKey])))

 

The error message is: MdxScript(Model) (4, 99) Calculation error in measure 'APEWeekly'[YTD2017]: Cannot convert value '27.12.2016' of type Text to type Date.

 

I understand that there is a problem with the date format for 27th December 2016. But I have no idea why as there is no error and the measure works in the Power BI desktop.

 

For clarification, the measure calculates YTD sales and I can't use the YTD function as our year starts on 27th of December 2016.

 

Thank you for your help.

 

Daniel

1 ACCEPTED SOLUTION
KHorseman
Community Champion
Community Champion

I don't think it has anything to do with that specific date, but with the way you're entering it. Instead of "27.12.2016" try using the DATE() function.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
KHorseman
Community Champion
Community Champion

I don't think it has anything to do with that specific date, but with the way you're entering it. Instead of "27.12.2016" try using the DATE() function.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Perfect, thank you very much! Now it works fine.

I hardly ever trust localized date order to work properly in Power BI or Excel. And I'm in the US. If it's at all possible to use a function to make the month and day explicit in a date, I always recommend using that option instead of letting the program try to parse a whole date.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.