The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
User | Count |
---|---|
25 | |
10 | |
8 | |
6 | |
5 |
User | Count |
---|---|
31 | |
11 | |
10 | |
10 | |
9 |