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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Pri
Frequent Visitor

'An Argument of Function Date has wrong data type or result is too small or too large'

I am getting below mentioned error with the following DAX statement:

 

An Argument of Function Date has wrong data type or result is too small or too large

 

Sales Avg1 =
VAR EndD = CALCULATE(MINX(Query2,Query2[DATE1]))
Var StartD = date(year(EndD)-1,MONTH(EndD),DAY(EndD))
return AVERAGEX(FILTER(Query1,DATESBETWEEN(Query1[Date],EndD,StartD)),Query1[Net_Revenue])
 
Can someone look into it please?
 
1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Pri 

 

Try this alternate

 

Sales Avg1 =
VAR EndD =
    CALCULATE ( MINX ( Query2, Query2[DATE1] ) )
VAR StartD =
    DATE ( YEAR ( EndD ) - 1, MONTH ( EndD ), DAY ( EndD ) )
RETURN
    AVERAGEX (
        FILTER ( Query1, Query1[Date] <= EndD && Query1[Date] >= StartD ),
        Query1[Net_Revenue]
    )

View solution in original post

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

@Pri 

 

Try this alternate

 

Sales Avg1 =
VAR EndD =
    CALCULATE ( MINX ( Query2, Query2[DATE1] ) )
VAR StartD =
    DATE ( YEAR ( EndD ) - 1, MONTH ( EndD ), DAY ( EndD ) )
RETURN
    AVERAGEX (
        FILTER ( Query1, Query1[Date] <= EndD && Query1[Date] >= StartD ),
        Query1[Net_Revenue]
    )

This has worked!

 

Many thanks 🙂

 

@Pri 

 

The 2nd argument of FILTER must return a BOOLEAN expression (true or false)

 

DATESBETWEEN(Query1[Date],EndD,StartD) returns a date table

Thats why it throws an error

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors