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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
saltycaramel
New Member

date related DAX error after published

Hi,

 

I created a custom colum using the dax below, using the column as a slicer to filter last week, this week, and next week.

It works well on Desktop, but the error occurs after publishing the report (it works right after the publish). Is it because the formula is too complicated? If yes, how would you simplfy it?

 

weeknum slicer =
var _cs = TODAY()-weekday(TODAY(),2)
var _ce = _cs+6
var _ne = _ce+7
var _ps = _cs-7
var _weeknum = FORMAT(WEEKNUM([Date]),"#")
RETURN
IF([Date]>=_cs&&[Date]<=_ce,"This week",IF([Date]>=_ps&&[Date]<_cs,"Last week",IF([Date]>=_cs&&[Date]<=_ne,"Next week",_weeknum)))

 

1 ACCEPTED SOLUTION
v-yifanw-msft
Community Support
Community Support

Hi @saltycaramel ,

From the formula you have shared, it appears to be well constructed. To troubleshoot please consider the following:

  1. Ensure that the Date column in Power BI Desktop and Services is indeed a date data type. Data type mismatches can sometimes cause problems after publishing.
  2. The TODAY() function in DAX uses the UTC date of the Power BI service, which may be different from the local time zone in Desktop. This may affect the calculation of variables. Consider whether time zone differences affect the behaviour of the slicer after release.

If the above suggestions did not help you, could you provide more details about the error message you received? For example a screenshot of the details of the reported error and whether you did anything else. Knowing the exact error message can help identify the problem more effectively.

 

Best Regards,

Ada Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
v-yifanw-msft
Community Support
Community Support

Hi @saltycaramel ,

From the formula you have shared, it appears to be well constructed. To troubleshoot please consider the following:

  1. Ensure that the Date column in Power BI Desktop and Services is indeed a date data type. Data type mismatches can sometimes cause problems after publishing.
  2. The TODAY() function in DAX uses the UTC date of the Power BI service, which may be different from the local time zone in Desktop. This may affect the calculation of variables. Consider whether time zone differences affect the behaviour of the slicer after release.

If the above suggestions did not help you, could you provide more details about the error message you received? For example a screenshot of the details of the reported error and whether you did anything else. Knowing the exact error message can help identify the problem more effectively.

 

Best Regards,

Ada Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.