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

Workdays Dax not working

Hello -

I have two tables - CalendarData & tblrma

CalendarData = Date table (Has a IsWorkday calculated column)

tblrma = facts table (Have total of 2 date fields that need checked)

 

The below DAX works in PowerPivot but does not work in PowerBI Desktop.  The error is: An invalid numeric representation of a date value was encountered.

 

= IF(AND([EstEmpty] = FALSE(), [POEmpty] = FALSE()),
        CALCULATE(Sum('CalendarData'[IsWorkday]),  
              DATESBETWEEN(CalendarData[Date], [estimatedate], [podate])), 
        Blank())

EstEmpty = test for blank (Checks for blank returns true false)

POEmty = Test for Blank (Checks for blank returns true false)

 

Any help is appreciated!

Raven

1 ACCEPTED SOLUTION
Anonymous
Not applicable

This worked after I formatted the Estimate and PO date fields to date only (no time).  goofy - but it worked right after the format.

 

Just in case anyone else was having problems. 

Raven

View solution in original post

6 REPLIES 6

I saw this error message in another post. Is [estimatedate] always before [podate]?



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Anonymous
Not applicable

No estimate date is not always before po date. 

So maybe that is the issue.  The syntax is From/To.  If from is after to, then maybe that is the issue.  You should test it.



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Anonymous
Not applicable

This worked after I formatted the Estimate and PO date fields to date only (no time).  goofy - but it worked right after the format.

 

Just in case anyone else was having problems. 

Raven

Anonymous
Not applicable

OK this error was truely because some of my date fields were messed up (ie: 5/1/151 or 5/1/203 or 5/1/2029

 

Mine worked when i used a query to get data - with a certain date range that did not include the messed up dates above. 

 

Just Learning

 

Raven

I receive this same error with my data model when trying to use any time intelligence function (previousmonth and previousyear in my case). 

 

For some reason, the data model automatically adds a timestamp to the end of each date type field which violates one of the requirements for a date table using time intelligence. The weird thing is, it also adds a timestamp to a MONTH_DIM table but that does not result in an error. My DATE_DIM table has no gaps or weird numbers in it after thorough insepction and analysis. 

 

I am using a simple formula:

 

=Calculate( Sum([SALES]), PREVIOUSMONTH('DATE_DIM'[FULL_DATE]) )


Any help would be appreciated. 

 

Thanks

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.