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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Lodewyk
Helper I
Helper I

Calculate Sales Tracking against target

Hi

 

I have 2 tables namely the target table and sales table.

 

the target table indicates the resource, with the target and whether it is monthly or annually. When the target is annual, the SUM of sales must be checked against the yearly target. When the target period is set to monthly, then every month the resource must achieve that target, there are no carryovers from the previous month. 

 

I need to present how the employee is tracking against the annual and monthly target

 

Lodewyk_0-1723406847149.png

 

Lodewyk_1-1723406861772.png

 

 

1 ACCEPTED SOLUTION

9 REPLIES 9
ahadkarimi
Solution Specialist
Solution Specialist

Hey @Lodewyk, try this code, and if you encounter any issues, let me know.

At first, go to "Modeling" tab and create a new calculated column in the Target table:

MonthlyTarget = IF(Target[Period] = "Annual", Target[Target] / 12, Target[Target])

 Then, create a new measure in the Sales table to sum the sales year-to-date for employees with an annual target:

CumulativeSales = 
CALCULATE(
    SUM(Sales[Sales]),
    FILTER(
        ALL(Sales),
        Sales[Resource] = MAX(Sales[Resource]) &&
        Sales[Reporting Month] <= MAX(Sales[Reporting Month])
    )
)

 After that, create a new measure to calculate how much of the target has been achieved:

PercentageAchieved = 
IF(
    RELATED(Target[Period]) = "Annual",
    DIVIDE([CumulativeSales], RELATED(Target[Target]), 0),
    DIVIDE(SUM(Sales[Sales]), RELATED(Target[MonthlyTarget]), 0)
)

 then add your charts (table, bar, line) and a slicer

Thanks for the above. After the Related syntax, no option appears. I tried to add the table and column name but it says does not exist. Please assist

@LodewykI'll do it with pride.

Lodewyk_0-1723439991383.png

@ahadkarimi , please see above and the pbix

If you encounter any issues, let me know.

ahadkarimi_0-1723473101594.png

 

 

Here is the PBIX file

Thank you, much appreciate

Anonymous
Not applicable

Hi @Lodewyk 

Please try the following measure:

Month target =
IF (
    CALCULATE (
        SELECTEDVALUE ( Sales[Sales] ) > SELECTEDVALUE ( Target[Target] ),
        FILTER ( 'Sales', SELECTEDVALUE ( Target[Period] ) = "Monthly" )
    ),
    "yes",
    "no"
)

 

Year target =
IF (
    CALCULATE (
        SUM ( Sales[Sales] ) > SELECTEDVALUE ( Target[Target] ),
        FILTER ( ALL ( 'Sales' ), SELECTEDVALUE ( Target[Period] ) = "Annual" )
    ),
    "yes",
    "no"
)

 

 

Result:

vjialongymsft_0-1723427913761.png

 

 

 

 

 

 

 

 

 

 

Best Regards,

Jayleny

 

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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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