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
x2kibail
Frequent Visitor

Creating a Dynamic Target Completion Measure

Hey guys!

 

Thanks in advance for your help.

 

I have a data table full of orders that my team must complete. Each row in the table holds the data for 1 order. As we fullfill these orders, they are marked complete. I'm currently tracking how many orders (order count by unique id field) are completed (status) by week and month (completion date) in a bar chart. I've been asked to add a line that shows if we're on track to complete all the orders by their due date. Target vs actual I guess?

 

I'm not sure how to go about creating the column/measure that will populate the line portion of the visual and would really appreciate some help. 

 

Another way to phrase what I'm trying to get ... let's say I was handed a table with 1200 orders at the beginning of the year and I need to have them all completed by the end of the year. After each week (Monday-Sunday) and at the end of each month, I want track my progress. At the start of the year, I know that I should be doing 100 orders each month and 100/(# of weeks in the month) in order to finish my goal on time, but let's say my first month I only complete 89. I'm behind by 11, and now need to complete 1 extra order each month to still finish on time ... how do I calculate that in power bi and do so in a format that the field can be put in the line option in a bar chart with line visuals (my actual completions will be the bars of the chart)?

 

The table looks something like this:

ID    STATUS         Completion Date     Completion Week (End of the Week)

1     Complete       1/1/2024                 1/7/2024

2     Complete       1/8/2024                1/14/2024

3     Complete        1/12/2024             1/14/2024          

4     Pending          null                         null

5     Pending           null                        null

6     Pending           null                        null

7     Pending           null                        null

8     Pending           null                        null

....

5 REPLIES 5
v-shex-msft
Community Support
Community Support

Hi @x2kibail ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
AnalyticsWizard
Solution Supplier
Solution Supplier

@x2kibail 

 

To achieve your goal of adding a line in a bar chart visual to track target vs. actual completions of orders in Power BI, you'll need to create a few DAX measures. These measures will help you visualize both the actual number of completed orders and the expected target for any given time point (week or month).

Here's how you can create these measures:

 

1. Calculate Target Completions:
First, you need a measure to calculate the target completions up to a given week or month. This measure will calculate the total orders divided by the number of periods (weeks or months) and then multiply by the elapsed periods.

 

Target Completions =
VAR TotalOrders = CALCULATE(COUNTROWS('Orders'), 'Orders'[STATUS] = "Complete" || 'Orders'[STATUS] = "Pending")
VAR Periods = DATEDIFF(MIN('Orders'[Completion Date]), MAX('Orders'[Completion Date]), MONTH)
VAR ElapsedPeriods = DATEDIFF(MIN('Orders'[Completion Date]), TODAY(), MONTH) + 1 // Assuming completion date is set and we're using months
RETURN
(TotalOrders / Periods) * ElapsedPeriods

 

This measure calculates how many orders should have been completed by now based on a simple distribution over time. Adjust `DATEDIFF` parameters if you're tracking by weeks or another time unit.

 

2. Calculate Actual Completions:
You probably already have this measure, but if not, here’s how you can calculate the actual completions:

 

Actual Completions =
CALCULATE(
COUNTROWS('Orders'),
'Orders'[STATUS] = "Complete",
ALL('Orders'[Completion Date]) // Removes filters on the date to count all completions
)

 

3. Combine in a Visual:
To combine these in a bar and line chart:
- Use "Actual Completions" for the bar chart values.
- Use "Target Completions" for the line chart values.

Select the bar and line chart visual in Power BI and drag your "Completion Date" to the axis, "Actual Completions" to the bar values, and "Target Completions" to the line values.

 

4. Adjusting for Tracking Errors:
If you're behind or ahead of schedule, your target completions will need to be recalculated monthly or weekly. You can adjust the `Target Completions` formula to factor in the difference between actual and planned as you move through the year.

 

Updated Target Completions =
VAR OriginalTarget = [Target Completions]
VAR CurrentPerformance = [Actual Completions]
VAR AdjustedTarget = IF(CurrentPerformance < OriginalTarget, OriginalTarget + ((OriginalTarget - CurrentPerformance) / (Periods - ElapsedPeriods)), OriginalTarget)
RETURN
AdjustedTarget

 

This setup allows you to see how well your team is performing against a distributed target of completions across the year. You can adjust these formulas based on your specific data structure and business logic.

 

If this post helps, please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍

Thank you for the help! Something doesn't seem right though ... I'm trying to insert the Target Completions Measurement into some visuals and it doesn't look as expected

 

x2kibail_0-1713974193535.png

 

Hi @x2kibail ,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Here is a subset of data. My current bar charts use End of the Week and Completion Month on the x-axis and the UniqueID on the y-axis for orders that have a completion date.

 

End of the week is set for Sunday to be the last day of the week.

https://docs.google.com/spreadsheets/d/1wT4LUCLqEfuBJS43IxYIcWSkqpWRjSUjGMnRiCVDYuY/edit?usp=drivesd...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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