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! Learn more

Reply
spagad6263
Post Patron
Post Patron

How can I calculate table total without first month?

Hi,

 

I have a table showing last 13 months sales from Sep 2024 to Sep 2025. I would like to set the first month color as RED, which is already done with the help from Power BI community. Now I would like to have the total as sum of the last 12 months, instead of 13. Can someone suggest and help? I use below DAX but it doesn't work

Last 12 Months Total =
VAR MinDate = MIN('Calendar'[Date])
VAR StartDate = DATE(YEAR(MinDate), MONTH(MinDate) + 1, 1)
VAR EndDate = MAX('Calendar'[Date])
RETURN
CALCULATE(
    [_Sales],
    DATESBETWEEN(
        'Calendar'[Date],
        StartDate,
        EndDate
    ),
    ALLSELECTED('Calendar')
)




1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

pls try this
VAR _MaxDate = EOMONTH( MAX('Calendar'[Date]),0)
RETURN
CALCULATE( [_Sales],
KEEPFILTERS(DATESINPERIOD('Calendar'[Date],_MaxDate,-12,MONTH)))

View solution in original post

5 REPLIES 5
Ahmedx
Super User
Super User

pls try this
VAR _MaxDate = EOMONTH( MAX('Calendar'[Date]),0)
RETURN
CALCULATE( [_Sales],
KEEPFILTERS(DATESINPERIOD('Calendar'[Date],_MaxDate,-12,MONTH)))

Thanks for the quick reply. I think your advice should work. I use below to get the answer I need. What I am trying to get now is to show the monthly sales as they are, but shows the total of last 12 month. Here is the screeshot. Instead of showing 23103, I would like to have the total as 21269. Any suggestion?

spagad6263_0-1760517749679.png

 



Last 12 Months Total =
VAR MinDate = MIN('Calendar'[Date])
VAR StartDate = DATE(YEAR(MinDate), MONTH(MinDate) + 1, 1)
VAR EndDate = MAX('Calendar'[Date])
RETURN
CALCULATE(
    [_Sales],
    FILTER(
        ALL('Calendar'[Date]),
        'Calendar'[Date] >= StartDate &&
        'Calendar'[Date] <= EndDate
    )
)

To fixed total, watch this video.
https://www.youtube.com/watch?v=yw0QHu9V4UQ

spagad6263
Post Patron
Post Patron

Can soeone suggest how I could upload powerbi app file? Thanks

You can create and update an app in the Power BI service. You can also upload a Power BI report file to the workspace and include it in the app. However, you cannot directly upload a Power BI app file itself. Could you please clarify what exactly you're trying to do?
Thanks

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