Forum Discussion

yolanda_meng's avatar
yolanda_meng
Advocate I
7 years ago
Solved

Error with PREVIOUSMONTH with calculated column

Has anyone noticed a difference today on PowerBI.com around the PREVIOUSMONTH function?

 

We have a DirectQuery report that is using this function, the month part was a calculated column from a date field, it was working fine on PowerBI.com for long time. Today we started to notice that the chart with this function was broken, after testing, we realized it was the incompatibility of the function with a calculated column - the error went away after we switched to a non-calculated column. 

 

The calculated month column: Month = DATE(YEAR(Query1[CreatedDate]),MONTH(Query1[CreatedDate]),1)

The measure with PREVIOUSMONTH: TEST = CALCULATE(COUNT(Query1[ClientId]),PREVIOUSMONTH(Query1[Month]))

 

Please provide any feedbacks or any thoughts, thanks a lot!

  • yolanda_meng i got bad news. Now the PREVIOUSMONTH  is not supported into Directquery.

     

    take a look in this article, and you will see: "This DAX function is not supported for use in DirectQuery mode. For more information about limitations in DirectQuery models, see http://go.microsoft.com/fwlink/?LinkId=219172."

     

    After your see this article i reccomend you to see the second link, to see all limitations with DAX. It has been changed probally in this last update.

     

    don't forget to mark this post as solution, other people can have the same situation in the future.

     

     

     

     

     

12 Replies

  • yolanda_meng hello, make sure that all date columns are okay, sometimes one row could have null values and it are 'crashing' your measure.

     

    If all are fine let me know! 

    • yolanda_meng's avatar
      yolanda_meng
      Advocate I

      Hi henriquesilveir,

       

      Thank you for your reply! Yes, we have noticed before that in Power BI desktop, if the date column is blank, the measure will break. However, this time we don't see the error in Power BI desktop as the date column is good, but then only break on app.powerbi.com. Any thoughts?