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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
k3rz0rg
Advocate III
Advocate III

How to add 1 month to the quarter in calculated measure?

Hi all , 

 

I have a calculation that is doing sum of sales quarterly and I was using QUARTER([date]) in where condition, ie:
calculate(
                  Sum([Sales])
                  ,YEAR([date])-1 = YEAR([enddate])-1 --Looking at last year
                  ,QUARTER([date]) <= QUARTER([enddate]) --comparing quarter to quarter
)
now I wanted to add one month to that QUARTER([enddate]) , can somebody help me to do so?
Adding + 1 adds another quarter to the enddate so definitely can't use that there... 

Thanks.

4 REPLIES 4
Ray_Minds
Responsive Resident
Responsive Resident

Please provide us some sample data with your expected result.

Awm
Frequent Visitor

Here is the modified version of your existing DAX formula:

 

QuarterSales = 
CALCULATE(
    SUM([Sales]),
    YEAR([date]) - 1 = YEAR([enddate]) - 1, -- Looking at last year
    QUARTER([date]) <= QUARTER(EDATE([enddate], 1)) -- Comparing quarter to adjusted quarter
)

 


In this approach, EDATE([enddate], 1) adds one month to the enddate, and QUARTER determines the new quarter based on this adjusted date.
Hope it helps!

Best regards,

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

sroy_16
Resolver II
Resolver II

Try using this DAX cide,

Sales QTD Adjusted =
VAR AdjustedEndDate = EOMONTH([enddate], 1)
VAR AdjustedQuarter = QUARTER(AdjustedEndDate)

RETURN
CALCULATE(
SUM([Sales]),
YEAR([date]) = YEAR([enddate]) - 1,
QUARTER([date]) <= AdjustedQuarter
)


Let me know if this solution works.

Hi @sroy_16 , thank you for your prompt response, I've tried that and weirdly, it's adding 2 months of sales instead of 1 month, I went through the documentation for EOMONTH and your one should work by adding 1 month, not sure why it's adding an extra month... Trying some more tweaks on this.

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors