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

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

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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.