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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
judddonnelly
Regular Visitor

Today()

I have the following measure that occasionally throws an error I believe to be associated with the Today().  

 

CurA =
AverageX(
CALCULATETABLE(
'FACT_PROD_CUM_VW',
FACT_PROD_CUM_VW[Prod Date] < DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY())-2), FACT_PROD_CUM_VW[Prod Date] > DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY())-8)
),
[Gross Oil]
)

 

 

Error message:

Feedback Type:
Frown (Error)

Timestamp:
2020-12-02T13:50:52.7737492Z

Local Time:
2020-12-02T06:50:52.7737492-07:00

Session ID:
1a828dce-0c42-46c5-b822-16998c6ff77c

Release:
October 2020

Product Version:
2.86.727.0 (20.10) (x64)

Error Message:
MdxScript(Model) (35, 40) Calculation error in measure 'FACT_PROD_CUM_VW'[CurA]: An argument of function 'DATE' has the wrong data type or the result is too large or too small.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@judddonnelly , When you subract days from date , like this DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY())-8)

 

On the 8th on month this will error as date do not take 0 in day .

Try like DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY())) -8

 

I have logged an issue sometime back on this.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@judddonnelly , When you subract days from date , like this DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY())-8)

 

On the 8th on month this will error as date do not take 0 in day .

Try like DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY())) -8

 

I have logged an issue sometime back on this.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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