Forum Discussion
Month To Date Help
- Anonymous1 year ago
Hi webbmd92,
Thanks for reaching out to the Microsoft fabric community forum.
It looks like you are faing issue with your PowerBi dashboard that compares Month-to-Date values of bookings and shipments against their respective goals.
You're encountering this issue because your current GOAL MTD measure uses the TODAY() function, which always evaluates to the current system date (e.g., 4/16/2025). This means that even when you select a different month, lets say May or June, the MTD goal calculation is still pulling values for April 16 which causes a mismatch when viewing historical months.
To make the GOAL MTD dynamically reflect the same day number relative to the selected month, you'll want to replace TODAY() with a logic that calculates the nth day of the selected month, based on today’s day.
You can try this DAX measure and check if it solves your issue.
Goal MTD Dynamic =
VAR SelectedDate = MAX('Calendar - Transaction Date'[Transaction Date])
VAR DayOfMonth = DAY(TODAY())VAR StartOfMonth = DATE(YEAR(SelectedDate), MONTH(SelectedDate), 1)
VAR EndOfPeriod =
MIN(
EOMONTH(SelectedDate, 0),
DATE(YEAR(SelectedDate), MONTH(SelectedDate), DayOfMonth)
)RETURN
CALCULATE(
SUM('Sales Targets'[Goal]),
'Calendar - Transaction Date'[Transaction Date] >= StartOfMonth &&
'Calendar - Transaction Date'[Transaction Date] <= EndOfPeriod
)This measure will dynamically compute the date range from the 1st of the selected month up to the same “day number” as today, and calculates the MTD goal accordingly.
I would also take a moment to thank amitchandak, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Best Regards,
Hammad.
Community Support TeamIf this post helps then please mark it as a solution, so that other members find it more quickly.
Thank you.
- 1 year ago
Thank you for your reply, I was able to figure it out creating a Binary IF statement when changing the Month(Date) Slicer.
Step 1:
CurrentMonth =IF (MONTH(TODAY()) = MAX('Calendar - Transaction Date'[Month]) && YEAR(TODAY()) = MAX('Calendar - Transaction Date'[Transaction Date Year Number]),1,0)Step 2:PreviousMonths =IF (MONTH(TODAY()) > MAX('Calendar - Transaction Date'[Month]) && YEAR(TODAY()) = MAX('Calendar - Transaction Date'[Transaction Date Year Number]) ||YEAR(TODAY()) > MAX('Calendar - Transaction Date'[Transaction Date Year Number]),1,0)Step 3:MTD BOOKING GOAL 2 =IF ([CurrentMonth]=1,[Today's ME Booking Goal],IF([PreviousMonths] = 1,[MonthEnd Bookings Goal],BLANK()))So if I am in current month I get "Today's" value, which is MTD(How the underlying data is setup), and if I am in a previous month, I get the total for that month.
Thank you for the reply. Unfortunately, neither DAX measure works. It is giving me the total sum for the whole columns.
Attached is the MTD Goal Table.
I think a better way to describe what I am trying to accomplish is if I am in current month I want today's value, if I am looking at a previous month I want to see MTD(which is essentially the entire month) or entire month summed.