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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
klehar
Helper V
Helper V

Need Target calculation based on running total

Here is my sample data.

I have sorted the running total.

Now I need to get the Target % which is Running Total for each cell/Budget column

Step 2  : I need to compare QoQ at week level if target was met or unmet.

E.g. Week 1 of Q2 compared to Q1 is 12% against 17%. If Week 2 target > Week 2 target of last quarter then Target is Met else Unmet

 

QuarterWeekBudgetActualsRunning TotalTarget %Target Met/Unmet
Q1W1300505017% 
Q1W2300247425% 
Q1W3300138729% 
Q1W43001910635% 
Q1W53002112742% 
Q1W63001113846% 
Q1W73004718562% 
Q1W83002521070% 
Q1W93001022073% 
Q1W103002624682% 
Q1W113002226889% 
Q1W123001528394% 
Q1W1330030313104% 
Q2W1400474712%Unmet
Q2W2400287519%Unmet
Q2W3400219624%Unmet
Q2W44002812431%Unmet
Q2W54002514937%Unmet
Q2W64001616541%Unmet
Q2W74004420952%Unmet
Q2W84003624561%Unmet
Q2W94001325865%Unmet
Q2W104002027870%Unmet
Q2W114002330175%Unmet
Q2W124003733885%Unmet
Q2W134004037895%Unmet

 

How do I write these 2 columns/measures?

1 ACCEPTED SOLUTION
Sahir_Maharaj
Super User
Super User

Hello @klehar,

 

Can you please try the following:

 

1. Calculate Target %

Target % = SalesData[Running Total] / SalesData[Budget]

2. Determine Target Met/Unmet

Target Met/Unmet = 
VAR CurrentWeek = SalesData[Week]
VAR CurrentQuarter = SalesData[Quarter]
VAR PreviousQuarterTarget = 
    CALCULATE(
        MAX(SalesData[Target %]),
        FILTER(
            ALL(SalesData),
            SalesData[Week] = CurrentWeek &&
            SalesData[Quarter] = IF(LEFT(CurrentQuarter, 1) = "Q" && LEN(CurrentQuarter) > 1, "Q" & (VALUE(MID(CurrentQuarter, 2, LEN(CurrentQuarter) - 1)) - 1), CurrentQuarter)
        )
    )
RETURN
    IF(
        ISBLANK(PreviousQuarterTarget),
        BLANK(),
        IF(
            SalesData[Target %] > PreviousQuarterTarget,
            "Met",
            "Unmet"
        )
    )

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

View solution in original post

1 REPLY 1
Sahir_Maharaj
Super User
Super User

Hello @klehar,

 

Can you please try the following:

 

1. Calculate Target %

Target % = SalesData[Running Total] / SalesData[Budget]

2. Determine Target Met/Unmet

Target Met/Unmet = 
VAR CurrentWeek = SalesData[Week]
VAR CurrentQuarter = SalesData[Quarter]
VAR PreviousQuarterTarget = 
    CALCULATE(
        MAX(SalesData[Target %]),
        FILTER(
            ALL(SalesData),
            SalesData[Week] = CurrentWeek &&
            SalesData[Quarter] = IF(LEFT(CurrentQuarter, 1) = "Q" && LEN(CurrentQuarter) > 1, "Q" & (VALUE(MID(CurrentQuarter, 2, LEN(CurrentQuarter) - 1)) - 1), CurrentQuarter)
        )
    )
RETURN
    IF(
        ISBLANK(PreviousQuarterTarget),
        BLANK(),
        IF(
            SalesData[Target %] > PreviousQuarterTarget,
            "Met",
            "Unmet"
        )
    )

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.