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
mm456
Frequent Visitor

Calculate 6 months sales from today

Hi All, 


I wish to calculate sales for 6 months and this should exclude sales from Jan. This should also be dynamic ie in August we should exclude Jan and Feb.

Heres the formula I've used but its not worked 

CALCULATE([Total Sales],
                       KEEPFILTERS( DATESINPERIOD ( CalendarDate[Date], MAX(CalendarDate[Date]),-6,MONTH)
                )
)

This is the output I desire 

Year-Mon6mth Total Sales (Desired) 6mth Total Sales (current output)
23-Jan $1,265.18
23-Feb$1,576.41$1,576.41
23-Mar$836.15$836.15
23-Apr$2,888.95$2,888.95
23-May$893.56$893.56
23-Jun$2,075.89$2,075.89
23-Jul$222.60$222.60


1 ACCEPTED SOLUTION
nandukrishnavs
Community Champion
Community Champion

@mm456  Try this 

 

 

6 Month Sales =
VAR _result =
    SUMX (
        KEEPFILTERS (
            DATESINPERIOD (
                CalendarDate[Date],
                TODAY (),
                -6,
                MONTH
            )
        ),
        [Total Sales]
    )
RETURN
    _result

 


Regards,
Nandu Krishna

View solution in original post

2 REPLIES 2
nandukrishnavs
Community Champion
Community Champion

@mm456  Try this 

 

 

6 Month Sales =
VAR _result =
    SUMX (
        KEEPFILTERS (
            DATESINPERIOD (
                CalendarDate[Date],
                TODAY (),
                -6,
                MONTH
            )
        ),
        [Total Sales]
    )
RETURN
    _result

 


Regards,
Nandu Krishna

Sharma_Yash
Frequent Visitor

hI @mm456 ,

Try the following formula:-

Last 6 months=
    CALCULATE([Total Sales],
                        DATESINPERIOD ( CalendarDate[Date],
                 MAX(CalendarDate[Date]),
                                    -6, MONTH)
                )
                                              
                
 
-If  you get the desired output, then please mark my post as solution.
 
Thankyou.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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