Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I have this table
I want to create a column that gets the total value of every previous month, like this
My DAX formula is the next one:
Total value of previous month =
VAR PreviousMonth = SUM(Hoja1[Month]) - 1
RETURN
CALCULATE(COUNTROWS(Hoja1), Hoja1[Month] = PreviousMonth)
This is what I get
How can I fix my DAX formula so I get what I need?
Solved! Go to Solution.
Hi @Anonymous
Is this a measure or a calculated column??If the latter:
Total value of previous month =
VAR PreviousMonth = Hoja1[Month] - 1
RETURN
CALCULATE(SUM(Hoja1[Value]), Hoja1[Month] = PreviousMonth, ALL(Hoja1))
although it would be wise to use year as well, not only month. What happens if Month = 1?
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi @Anonymous
Is this a measure or a calculated column??If the latter:
Total value of previous month =
VAR PreviousMonth = Hoja1[Month] - 1
RETURN
CALCULATE(SUM(Hoja1[Value]), Hoja1[Month] = PreviousMonth, ALL(Hoja1))
although it would be wise to use year as well, not only month. What happens if Month = 1?
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers