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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
I am trying to use IF and DATEADD in a calculated column. It doesn't seem to be working right. Does anyone have suggestions? What I would like the formula to do is to look up the month in my date column and do calculation if the month is March, June, Sept, or December. Perhaps there is an easier way to do this. So I am open to suggestions or other ideas.
If the month is one of those months, then the calculation needs to be as follows:
([Fund Val Ex Cash $])
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -1, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -1, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -2, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -2, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -3, MONTH)))
)
I am trying to use the formula below, but it is just pulling the first month's value and dividing by 6. Does anyone have any ideas? This needs to be in a calculated column.
Thank you!
Fund Ex Cash Avg TEST =
if(MONTH('FundCustValAll'[DATE]) = 12,
DIVIDE(
(
([Fund Val Ex Cash $])
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -1, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -1, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -2, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -2, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -3, MONTH)))
), 6),
(if(MONTH('FundCustValAll'[DATE]) = 9,
DIVIDE(
(
([Fund Val Ex Cash $])
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -1, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -1, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -2, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -2, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -3, MONTH)))
), 6),
(if(MONTH('FundCustValAll'[DATE]) = 6,
DIVIDE(
(
([Fund Val Ex Cash $])
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -1, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -1, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -2, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -2, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -3, MONTH)))
), 6),
(if(MONTH('FundCustValAll'[DATE]) = 3,
DIVIDE(
(
([Fund Val Ex Cash $])
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -1, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -1, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -2, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -2, MONTH)))
+
(CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -3, MONTH)))
), 6),
0)))))))
Solved! Go to Solution.
Hi @ARob198 ,
The DATEADD() function can be used in a calculated column and measure, and require contiguous date selection in it . You may create calendar table first of all, create relationship between the fact data table and calendar table on date field. then use the Calendar'[Date] in DATEADD .
Calendar= CALENDARAUTO()
If you need to pull the values for a previous month in a calculated column, your formula " CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -1, MONTH))" is ok.
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@ARob198 , I am not able to relate this formula with your requirement
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
I am not sure what you would like me to share. Is it possible to use DATEADD in a calculated column? I guess let's start there. Is that possible or is DATEADD only for use in measures?
If DATEADD is only for measures, what is the equivalent function for a calculated column? How can you pull the values for a previous month in a calculated column for use in a calculation?
Hi @ARob198 ,
The DATEADD() function can be used in a calculated column and measure, and require contiguous date selection in it . You may create calendar table first of all, create relationship between the fact data table and calendar table on date field. then use the Calendar'[Date] in DATEADD .
Calendar= CALENDARAUTO()
If you need to pull the values for a previous month in a calculated column, your formula " CALCULATE([Fund Val Ex Cash $], DATEADD('Calendar'[Date], -1, MONTH))" is ok.
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 43 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |