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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Oros
Resolver III
Resolver III

Dynamic Sales Goals per Month

Hello,

 

I have a Sales table and a Calendar table.

 

The total sales goal for the enitre year is set at $1,200. Then the monthly goal is a static goal of $100 per month ($1,200/12)

 

What would be the correct measure to make the succeeding monthly goal take into account the negative difference between the actual sales vs the sales goal for the month?  Thanks.

 

In other words...

Monthly Sales Goal=$100

If actual sales goal < monthly sales goal, then add the diffrence to the Monthly Sales Goal.

 

For example,

If January actual sales = $90, then the February Goal should be $100 +$10.

If the February actual sales is again $90, then the march goal should be $100+$10+$10

If the March actual sales is $120, then the April goal should be back to $100

 

 

Monthly Sales GoalsMonthly Sales Goals

 

 

 

 

 

 

4 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

Subtract the cumulative sales for a given month from the cumulative goal for that month.

View solution in original post

danextian
Super User
Super User

Hi @Oros 

Use a separate dates table, relate that to your fact table and create these measures:

 

Monthly Goal = 
100

Cumulative Difference =
MAX (
    0,
    SUMX (
        FILTER (
            ALL ( CalendarTable ),
            CalendarTable[Month] <= MAX ( CalendarTable[Month] )
        ),
        CALCULATE ( [Monthly Goal] - SUM ( 'Table'[Actual Sales] ) )
    )
)

Adjusted Goal = 
---even if the cumulative difference is negative, the goal is minimum of 100
IF (
    [Cumulative Difference] > 0,
    [Monthly Goal] + [Cumulative Difference],
    [Monthly Goal]
)

 

 

danextian_0-1733022028511.png

Please see attached sample pbix for your reference.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

v-kaiyue-msft
Community Support
Community Support

Hi @Oros ,

 

You can refer to the following steps:


1. in power query editor, after selecting salesperson column, select inverse pivot other columns. Same operation for both tables.

vkaiyuemsft_0-1733118767225.png

 

2. create relationships between the tables.

vkaiyuemsft_1-1733118773893.png

 

3. create these measures.

Monthly Sales Goal = 
CALCULATE(MAX('GOALS'[Value]),FILTER('GOALS','GOALS'[SALESPERSON] = MAX('SALES'[SALESPERSON])))


Cumulative Difference = 
CALCULATE(
    SUMX(
        Sales,
        [Monthly Sales Goal] - SALES[Value]
    ),
    FILTER(
        ALL('Calendar'),
        Calendar[Date] <= MAX(Calendar[Date])
    )
)

Salesperson Cumulative Difference = 
CALCULATE(
    SUMX(
        Sales,
        IF('SALES'[Value] <> BLANK(),
        [Monthly Sales Goal] - SALES[Value],
        0)
    ),
    FILTER(
        ALL('Calendar'),
        Calendar[Date] <= MAX(Calendar[Date])
    ),
    'SALES'[Salesperson] = MAX('SALES'[Salesperson])
)

Measure = 
SUMX(FILTER(ALLSELECTED('SALES'[Attribute]),'SALES'[Attribute] <= MAX('SALES'[Attribute])),[Salesperson Cumulative Difference])

Salesperson Adjusted Monthly Goal = 
[Monthly Sales Goal] + [Measure]

 

The final result is shown below, more details can be found in the attachment.

vkaiyuemsft_2-1733118811903.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

View solution in original post

16 REPLIES 16
v-kaiyue-msft
Community Support
Community Support

Hi @Oros ,

 

You can refer to the following steps:


1. in power query editor, after selecting salesperson column, select inverse pivot other columns. Same operation for both tables.

vkaiyuemsft_0-1733118767225.png

 

2. create relationships between the tables.

vkaiyuemsft_1-1733118773893.png

 

3. create these measures.

Monthly Sales Goal = 
CALCULATE(MAX('GOALS'[Value]),FILTER('GOALS','GOALS'[SALESPERSON] = MAX('SALES'[SALESPERSON])))


Cumulative Difference = 
CALCULATE(
    SUMX(
        Sales,
        [Monthly Sales Goal] - SALES[Value]
    ),
    FILTER(
        ALL('Calendar'),
        Calendar[Date] <= MAX(Calendar[Date])
    )
)

Salesperson Cumulative Difference = 
CALCULATE(
    SUMX(
        Sales,
        IF('SALES'[Value] <> BLANK(),
        [Monthly Sales Goal] - SALES[Value],
        0)
    ),
    FILTER(
        ALL('Calendar'),
        Calendar[Date] <= MAX(Calendar[Date])
    ),
    'SALES'[Salesperson] = MAX('SALES'[Salesperson])
)

Measure = 
SUMX(FILTER(ALLSELECTED('SALES'[Attribute]),'SALES'[Attribute] <= MAX('SALES'[Attribute])),[Salesperson Cumulative Difference])

Salesperson Adjusted Monthly Goal = 
[Monthly Sales Goal] + [Measure]

 

The final result is shown below, more details can be found in the attachment.

vkaiyuemsft_2-1733118811903.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

Hi @v-kaiyue-msft,

 

Thank you so much!  It works! 

danextian
Super User
Super User

Hi @Oros 

Use a separate dates table, relate that to your fact table and create these measures:

 

Monthly Goal = 
100

Cumulative Difference =
MAX (
    0,
    SUMX (
        FILTER (
            ALL ( CalendarTable ),
            CalendarTable[Month] <= MAX ( CalendarTable[Month] )
        ),
        CALCULATE ( [Monthly Goal] - SUM ( 'Table'[Actual Sales] ) )
    )
)

Adjusted Goal = 
---even if the cumulative difference is negative, the goal is minimum of 100
IF (
    [Cumulative Difference] > 0,
    [Monthly Goal] + [Cumulative Difference],
    [Monthly Goal]
)

 

 

danextian_0-1733022028511.png

Please see attached sample pbix for your reference.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian ,

Thank you so much for your quick response and for sending a sample pbix.

 

It seems that your solution is pretty straightforward.  What if the monthly goal is dependent on each salesperson.  In other words, the monthly goal of $100 can change depending of the selected salesperson?  How do you adjust the the measures from your solution?  Thanks again.

 

Oros_0-1733028436512.png

 

 

 

Please provide a sample data so the solution can be based on that. And please, not an image.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian,

 

Unfortunately, I do not see any method for me to attach a pbix file.

You can post a link to cloud.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian,

 

Here is the sample data.  Thanks.

https://filebin.net/z393w5ubbbngpl5x

Hi @danextian,

 

It works too!  Thanks. 

Please mark my post as solution if it does. Thanks!










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Next step is to add a proper calendar table to your data model. That will help you to sort the months in the right order, and will allow you to caclulate this across (fiscal) years.

lbendlin
Super User
Super User

Subtract the cumulative sales for a given month from the cumulative goal for that month.

Hi @lbendlin,

 

It works.  Thanks.

Hi @lbendlin ,

 

Thank you very much for your quick reply.

What would be the exact measure to represent this solution?  Thanks again.

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information. Do not include anything that is unrelated to the issue or question.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Hi @lbendlin,

 

Here is the sample data.

https://filebin.net/z393w5ubbbngpl5x

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.