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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Eduardo6
Frequent Visitor

An argument of function date has the wrong data type or the result is too large or too small

I would like to only calculate the sum of values after a certain date. I do not want to have to manually key in the date every month as new data comes in. I have created a Measure to isolate the latest data point, however the target date I'm after is always 3 months prior to the maximum posting date of the data. Sorry for the huge amount of detail. I have spent alot of time on this both trying things out and reading other similar issues. 

 

1. Pull the max posting date. This Measure works fine!

Date Latest Actuals=

MAX('Actuals'[PostingDate])

 

2. Isolate the variables to be input into the target date measure

Date Year=

Year([Date Latest Actuals])

Date Month=

Month([Date Latest Actuals])

Date Year=

Day([Date Latest Actuals])
 
3. Combine the measures above to create the Target Date, this works fine when I pull it into a card.
DateTarget=
DATE([Date Last Year],[Date Last Month]-3,[Date Last Day])
 
4. Use the Target date in a calculation, This is where it breaks down.
SalesFcst= Calculate(sum('Fcst'[Sales]), FILTER('Date','Date'[DATE]>[DateTarget]))
 
I've also tried
SalesFcst= Calculate(sum('Fcst'[Sales]), FILTER('Fcst','Fcst'[Date]>[DateTarget]))
 
Below works but this is my original measure that is not 3 months prior, so no use, but I wanted to make sure a measure could be used in this calculation.
SalesFcst= Calculate(sum('Fcst'[Sales]), FILTER('Fcst','Fcst'[Date]>[Date Latest Actuals]))
 
As you can tell from the measures above I have 3 sets of dates (Date Table, Fcst Table has dates, Actuals Table has dates)
Date table was built using 
Date= CALENDAR(DATE(2014,1,1),DATE(2023,12,31))
 
Fcst Table has dates from 1/1/2019-12/1/2021 in month/day/year format
Actuals Table has dates from 1/1/2016-6/1/2020
 
If you made it all the way down here, thank you in advance for your time!
 
 
 
6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

@Eduardo6 - I suppose the first thing to check would be to make sure that your measure is set to be a Date data type and not text for example. Second thing I would check would be to have SalesFcst measure just return Date Latest Actuals so that you can check what the value of that is in context of where you are using it.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler  the measure is set to be a Date. When I change the SalesFcst measure to just return the Latest Actuals date it returns the following

YearMonthSalesFcst
2018June6/1/2018
2018July7/1/2018
2018August8/1/2018
2018September9/1/2018
2018October10/1/2018

@Eduardo6 - Any chance that there is some value in 'Fcst'[Date] that is like blank or something like that?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler - No blanks in that date column. 

Well, there may not be, but is that true within the context of the visualization? That's the key with measures.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Within the context of the visualization there would be blanks. The visualization is just a table, My dates column pulls from my date table (parameters below) and my FcstTable dates do not span as long. But this is the case with my Actuals Table as well and when I use the measure I created from that table it works fine. 
 
Date= CALENDAR(DATE(2014,1,1),DATE(2023,12,31))
Fcst Table has dates from 1/1/2019-12/1/2021 in month/day/year format
 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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