cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Impactful Individual

## Dynamic Week on Week Target

hi All

I am looking to create a dynamic Week on Week Target which should be based on Actuals

so there is Target set for each week as you can see below, if lets say in the Week 2, we over achieve the Target  which in the below case 6,483.88, this Variance should be equally needs to be passed on to the remaining weeks, this way every week, Target should dynamically change based on what actuals we have , if the Target is not met, then subsequent weeks target should increase and decrease vice versa

i tried creating something using Chat GPT but it doesn't give me the right output

VAR CurrentWeek = MAX('YTD Timesheet'[Week])

VAR CurrentWeekTarget = [Tar WTD]

VAR PreviousWeekVariance = CALCULATE([Variance], FILTER(ALL('YTD Timesheet'), 'YTD Timesheet'[Week] = CurrentWeek - 1))

VAR RemainingTarget = CurrentWeekTarget -[YTD Charged Hours]

VAR RemainingWeeks = 52-MAX('Calendar'[#Week])

VAR ProratedVariance = IF(RemainingWeeks > 0, PreviousWeekVariance / RemainingWeeks, 0)

VAR IsTargetOverAchieved = IF([YTD Charged Hours] > CurrentWeekTarget, 1, 0)

IF(

IsTargetOverAchieved,

IF(

RemainingWeeks > 0,

CurrentWeekTarget - ProratedVariance,

CurrentWeekTarget

),

IF(

RemainingWeeks > 0,

CurrentWeekTarget + ProratedVariance,

CurrentWeekTarget

)

)

RETURN

RemainingTarget

please help, i spent a full day in figuring out, how to arrive at  Revised Target based on Actuals

2 REPLIES 2
Community Support

Hi @vjnvinod ,

@vjnvinod As you said: "if the Target is not met, then subsequent weeks target should increase and decrease vice versa", so the plus and minus signs here in DAX should be reversed:

And here, what is the table Calendar?

Other than that, there's nothing else wrong with this DAX, and I've tested it, and here's what I got:

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Super User

@vjnvinod Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors