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
mpmsltd
Helper I
Helper I

Beginning of the year + 3 months DAX Calculation

Hi All,

 

I'm trying to create a DAX formula that for each year does a sum of my values from day 1 until day 90 of the same year. 

 

I tried to use the DAX below but it didn't really work, I've got the following error:

a table of multiple values was supplied where a single value was expected

 

Year + 3 Months IT = CALCULATE(sum(Values[values]),DATESBETWEEN('DATE'[Date],STARTOFYEAR('DATE'[Date]),DATEADD('DATE'[Date],3,MONTH)))
 
Any help is appreciated,
thanks!
1 ACCEPTED SOLUTION

Thanks Greg, I've tweaked a little bit since the Year function wouldn't let me add a column but only another function.

 

This is what I did and it worked 

 

Year + 3 Months IT =
VAR __YearStart = STARTOFYEAR('DATE'[Date])
VAR __End = (__YearStart + 89) * 1.
RETURN
SUMX(
FILTER(
Valued,
Values[Date] >= __YearStart && Values[Date]<= __End
),
Values[Value]
)

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

Perhaps:

 

Year + 3 Months IT = 
VAR __YearStart = DATE(YEAR('Values'[Date]),1,1)
VAR __End = (__YearStart + 89) * 1.
RETURN
  SUMX(
    FILTER(
      'Values',
      [Date] >= __YearStart && [Date] <= __End
    ),
    'Values'[Value]
  )

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Your solution was a great help, really appreciated it!

Thanks Greg, I've tweaked a little bit since the Year function wouldn't let me add a column but only another function.

 

This is what I did and it worked 

 

Year + 3 Months IT =
VAR __YearStart = STARTOFYEAR('DATE'[Date])
VAR __End = (__YearStart + 89) * 1.
RETURN
SUMX(
FILTER(
Valued,
Values[Date] >= __YearStart && Values[Date]<= __End
),
Values[Value]
)

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.