cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to find the states and regions that have achieved their current year sales targets

I have a sales order table with the Order ID, Order Date, Year, Regio, State, Sales Amount, Quantity, Discount, and etc.

R_S13697_0-1669825640605.png

I have another table with the sales target for a given state, in a year and month.

R_S13697_2-1669829730801.png

 

How to find the states(Highlight) that have achieved their sales target?

Thank you. Any help would be appreciated.

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.
Sample data:

Table1:

vzhangti_0-1669881058111.png

Table2:

vzhangti_1-1669881079343.png

Column:

Order Month = MONTH([Order Date])
Sales Sum = CALCULATE(SUM(Table1[Sales Amount]),
       ALLEXCEPT(Table1,Table1[Year],Table1[Order Month],Table1[Postal Code]))
Target = LOOKUPVALUE(Table2[Target],
                    Table2[Year],[Year],
                    Table2[Month],[Order Month],
                    Table2[State],[Postal Code])
Result = IF([Sales Sum]>=[Target],1,0)

vzhangti_2-1669881191391.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.
Sample data:

Table1:

vzhangti_0-1669881058111.png

Table2:

vzhangti_1-1669881079343.png

Column:

Order Month = MONTH([Order Date])
Sales Sum = CALCULATE(SUM(Table1[Sales Amount]),
       ALLEXCEPT(Table1,Table1[Year],Table1[Order Month],Table1[Postal Code]))
Target = LOOKUPVALUE(Table2[Target],
                    Table2[Year],[Year],
                    Table2[Month],[Order Month],
                    Table2[State],[Postal Code])
Result = IF([Sales Sum]>=[Target],1,0)

vzhangti_2-1669881191391.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

ryan_mayu
Super User
Super User

pls share the sample data, not the screenshot. and pls also provide the expected output based on the sample data you provided.





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

Proud to be a Super User!




Helpful resources

Announcements
Exciting changes

Power BI Community Changes

Check out the changes to the Power BI Community announced at Build.

May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Kudo Data Story carousel

Data Stories Gallery

Visit our Data Stories Gallery and give kudos to your favorite Data Stories.

Top Solution Authors