Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
vjnvinod
Impactful Individual
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

 

Adjusted Target =

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)

VAR AdjustedTarget =

    IF(

        IsTargetOverAchieved,

        IF(

            RemainingWeeks > 0,

            CurrentWeekTarget - ProratedVariance,

            CurrentWeekTarget

        ),

        IF(

            RemainingWeeks > 0,

            CurrentWeekTarget + ProratedVariance,

            CurrentWeekTarget

        )

    )

RETURN

    RemainingTarget

vjnvinod_0-1713706754482.png

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

2 REPLIES 2
v-junyant-msft
Community Support
Community Support

Hi @vjnvinod ,

@Greg_Deckler Thanks for your concern about this case!

@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:

vjunyantmsft_0-1713946753697.png

 

And here, what is the table Calendar?

vjunyantmsft_1-1713946847779.png


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

vjunyantmsft_2-1713947003185.png


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.

Greg_Deckler
Super User
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

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

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.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.