Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
Hi All,
I'm doing forecast figures for some projects and I have been asked that in the current month (in this case March 2022) when the date is below the 15th the forecast figure should be Previous Month Actual Cost, when equal to or above 15th of this current month it returns Actual Cost for March 2022, April onward display budget figure.
In the picture below, Actual and Forecast is the column/measure that needs changing. I have added Budget and Actual Cost in Variance measure to derive Actual and Forecast column, however, March shows 618 but should be 200 (Previous month actual cost) until its 15th of March then shows 485.. April going forward has the correct figure as they are.
Thanks in advance.
Solved! Go to Solution.
How about now? Tomorrow it will be 485 😁
Measure =
SWITCH
(
TRUE(),
AND
(
SELECTEDVALUE('Date'[Month_no]) < MONTH(TODAY()),
SELECTEDVALUE('Date'[Year]) <= YEAR(TODAY())
),
SUM('Budget Actual'[Actual Cost]), --Before Active Month
AND
(
SELECTEDVALUE('Date'[Month_no]) > MONTH(TODAY()),
SELECTEDVALUE('Date'[Year]) >= YEAR(TODAY())
),
[Actual and forecast], --After Active Month
TODAY () <
DATE
(
YEAR(TODAY()),
MONTH(TODAY()),
15
),
[Actual and Forecast PM], -- Active Month, Before 15
SUM('Budget Actual'[Actual Cost]) -- Active Month, After 15
)
@coskuersanli I think we are sooo close! However, Feb and March should have the same number now (200) until its 15th of March then march changes to March Actual which is 485. It's a very tricky one.
Only the current month picks the Previous Month's value when it's not yet the 15th of the month. Past months should have Actuals for the month and future month have forecast (we have no problem with forecast at the moment).
Thanks so far.
How about now? Tomorrow it will be 485 😁
Measure =
SWITCH
(
TRUE(),
AND
(
SELECTEDVALUE('Date'[Month_no]) < MONTH(TODAY()),
SELECTEDVALUE('Date'[Year]) <= YEAR(TODAY())
),
SUM('Budget Actual'[Actual Cost]), --Before Active Month
AND
(
SELECTEDVALUE('Date'[Month_no]) > MONTH(TODAY()),
SELECTEDVALUE('Date'[Year]) >= YEAR(TODAY())
),
[Actual and forecast], --After Active Month
TODAY () <
DATE
(
YEAR(TODAY()),
MONTH(TODAY()),
15
),
[Actual and Forecast PM], -- Active Month, Before 15
SUM('Budget Actual'[Actual Cost]) -- Active Month, After 15
)
@coskuersanli Thank you so so much. It worked! I have to change my Month No to wholenumber instead of text then Boom!
I think we've done it this time 🙂
I've added a month column to Date table with MONTH(Date[Date]) and changed the measure a little. (DATE function was wrong.)
Measure =
SWITCH
(
TRUE(),
AND
(
SELECTEDVALUE('Date'[Month_no]) > MONTH(TODAY()),
SELECTEDVALUE('Date'[Year]) >= YEAR(TODAY())
),
[Actual and forecast],
TODAY () <=
DATE
(
YEAR(TODAY()),
MONTH(TODAY()),
15
),
[Actual and Forecast PM],
[Actual and Forecast]
)
Hi @BGB ,
Can you try this please? 🙂
SWITCH
(
TRUE(),
TODAY <=
DATE
(
15,
MONTH(TODAY()),
YEAR(TODAY())
),
previous_month,
actual_forecast
)
I've changed it a little, this should work.
SWITCH
(
TRUE(),
AND
(
MONTH(dates_table[date]) > MONTH(TODAY()),
YEAR(dates_table[date]) > YEAR(TODAY())
),
budget,
TODAY <=
DATE
(
15,
MONTH(TODAY()),
YEAR(TODAY())
),
previous_month,
actual_forecast
)
@coskuersanli Thanks for looking at this.
When I tried this in a measure it won't accept 'Date'[date] and when I tried to use it as a column it didn't accept today
line 7..
Can you put () after TODAY and try again? 🙂
@coskuersanli Apologies if I'm starting to sound thick. I have left a screen short to this. I wonder why I'm not allowed to upload the PBIx file.
Picture 2 shows the switch didn't happen. Also, I had to use the date within my dataset as datetable date was not allowed (Didn't come up)
March 2022 should be showing PM figure.
The column formula
User | Count |
---|---|
91 | |
88 | |
88 | |
79 | |
49 |
User | Count |
---|---|
153 | |
145 | |
106 | |
74 | |
55 |