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
Analitika
Post Prodigy
Post Prodigy

An argument of function 'DATE' has the wrong data type or the result is too large or too small.

I need to crete filter by week ranges

 

Analitika_0-1598429845010.png

Now 

Range = 

 
var Year1 = 'Date'[Date].[Date]
var Year2 = INT('Date'[Year])
VAR conc= ROUNDDOWN(DIVIDE('Date'[WeekN]-1,4),0)
var WeekS= format(if(conc=0, 1, conc*4+1),"#")
var WeekEnd= format(CALCULATE((conc+1)*4),"#")
return
WeekS & "-" & WeekEnd

 

 

but when i select whool range i got error in visuals or do not showing info at all

 

Error Message:
MdxScript(Model) (332, 13) Calculation error in measure 'DK'[rate %]: An argument of function 'DATE' has the wrong data type or the result is too large or too small.

 

 

rate % =
var earnings= [LY]
VAR midC= MAX('Date'[Date])
var midC2= date(year(midC)-1,MONTH(midC),DAY(midC))
var stock1 = CALCULATE(sum([sum]), FILTER(ALL('Date'[Date]),'Date'[Date]<=midC))
var stock2 = CALCULATE(sum([sum]), FILTER(ALL('Date'[Date]),'Date'[Date]<=midC2))
VAR new= DIVIDE(earnings,stock2 )
var old= DIVIDE([CountS],stock1 )
RETURN

FORMAT((new-old),"0.00%")
7 REPLIES 7
Icey
Community Support
Community Support

Hi @Analitika ,

 

Please let me know if the link I post above is helpful.

 

 

Best Regards,

Icey

TY, your post is not helpful

amitchandak
Super User
Super User

@Analitika , rate %  seems correct. Unless there is an error Range. Can you check them separately.

error only if whoole group of week select, if selected week separately everithing work

All looks ok , are you using date in measures of [LY] or [CountS] seems like problem happening at these measures.

 







Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




countS =
ROUND (
    CALCULATE (
        CALCULATE ( SUM ( [sum2] ) ),
        FILTER (
            'T1',
            'T1'[Table] = "t"
                && NOT 'T1'[item] IN { "1", "2", "3" }
        )
    ),
    0
)

 

LY = CALCULATE ([countS], dateadd( 'Date'[Date],-1,YEAR))

 

 

No matter which measure,  every measure return empty if whoole weeks range selected, and return sums if selected separetly weeks

Icey
Community Support
Community Support

Hi @Analitika ,

 

Please check if this post helps:

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

 

In addition, are [sum] and [sum2] measures? If they are, need to use SUMX inteading of SUM function.

 

 

 

Best regards

Icey

 

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

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.