Forum Discussion
3 months Total DAX Measure
Hi All,
I need a Measure to calcualte the 3 Months total as shonw in follwoing screen print. please assit. Thanks
Ex : - Jan,Fab & Mar total shown be the 3 Months accross Jan,Feb & Mar (1598+1735+1659) = 4992 etc...
Hi Suhel_Ansari ,
Please use this DAX to achieve your goal:
QuarterlyTotal = VAR CurrentQuarter = QUARTER(MAX('Table'[Edate])) VAR CurrentYear = YEAR(MAX('Table'[Edate])) RETURN CALCULATE( SUM('Table'[Saless]), FILTER( ALL('Table'), YEAR('Table'[Edate]) = CurrentYear && QUARTER('Table'[Edate]) = CurrentQuarter ) )Your final result will look like this:
4 Replies
- Bibiano_Geraldo
Super User
Hi Suhel_Ansari ,
Please use this DAX to achieve your goal:
QuarterlyTotal = VAR CurrentQuarter = QUARTER(MAX('Table'[Edate])) VAR CurrentYear = YEAR(MAX('Table'[Edate])) RETURN CALCULATE( SUM('Table'[Saless]), FILTER( ALL('Table'), YEAR('Table'[Edate]) = CurrentYear && QUARTER('Table'[Edate]) = CurrentQuarter ) )Your final result will look like this:
- Suhel_Ansari
Helper V
Tahreem24 please assist 🙏
- Tahreem24
Super User
Suhel_Ansari I recommend uzuntasgokberk solution for your case if you have multiple years.
Otherwise try this DAX: (This only works for one year period as per your given data)Measure 2 = CALCULATE(SUM('Table'[Sale]),FILTER(ALLSELECTED('Table'),QUARTER('Table'[Edate])<=QUARTER(MAX('Table'[Edate]))))
- uzuntasgokberk
Super User
Hello Suhel_Ansari ,
Could you try below the dax code:
"
Total 3-Months =
CALCULATE(
SUM('YourTable'[Sales]),
FILTER(
ALL('YourTable'[Date]),
YEAR('YourTable'[Date]) = YEAR(MAX('YourTable'[Date])) &&
QUARTER('YourTable'[Date]) = QUARTER(MAX('YourTable'[Date]))
)
)
"Kind Regards,
Gökberk Uzuntaş
📌 If this post helps, then please consider Accepting it as a solution and giving Kudos — it helps other members find answers faster!
🔗 Stay Connected:
📘 Medium |
📺 YouTube |
💼 LinkedIn |
📷 Instagram |
🐦 X |
👽 Reddit |
🌐 Website |
🎵 TikTok |