cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MaryMThompson
Level: Powered On

Need Help with Calculated Fields

Goal: Create an app that will calculate commission based on Zip code of shipment.

 

Currently I have the set up the following: Created an entity, to pull the posted sales invoice records, including the Doc. Number, Amount, Sales Person, and zip code.

 

Since the zip code determines the % that will be applied against the amount, I have a spreadsheet listing the specific % for each zip code.

 

How can I merge the two together, to basically read "if zip code is (x), then it pulls the correct % from the second list. 

 

Any help would be great!!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Need Help with Calculated Fields

Hi @MaryMThompson ,

You should use above formula I provided within your PowerApps app rather than within your Entity.

 

If you added a Gallery control within your app to list all records in your Entity (posted sales invoice records), you could consider add a Label control within the Gallery, set the Text property to following:

LookUp('YourSecondTable', 'Zip code' = ThisItem.'zip code', 'Commission Ratio')

then the corresponding 'Commission Ratio' value related to specific 'Zip code' value would be shown up within your Gallery items.

 

If you want to merge your two data sources into a single one table within your app, please set the OnStart property of the App control to my above ClearCollect formula:1.JPG

then save and re-load your app, then you could use the merged table within your app as data source.

 

Based on the needs that you mentioned, I think the above solution I provided could achieve your needs. Please consider take a try with above solution, check if it could help in your scenario.

 

If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
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

4 REPLIES 4
Community Support Team
Community Support Team

Re: Need Help with Calculated Fields

Hi @MaryMThompson ,

Could you please share a bit more about the data structure of the second list/Excel table?

Do you want to lookup the  commission % in your second list based on the specific zip code?

Further, do you want to merge the two data source into a Single one table?

 

Based on the needs that you mentioned, I think the LookUp function could achieve your needs. I have made a test on my side, please take a try with the following workaround:

I assume that the data structure of your second List as below:

 

2.JPG

if you want to get the corresponding commission ratio (%) for specific zip code, please take a try with the following formula:

LookUp('YourSecondTable', 'Zip code' = "A specific zip code", 'Commission Ratio')

Or

LookUp('YourSecondTable', 'Zip code' = "A specific zip code").'Commission Ratio'

Note: The 'Zip code' and 'Commission Ratio' represents the columns in your second List.

 

If you want to merge the two data sources (Your Entity and the second List) into single one table, I think the AddColumns function could achieve your needs in your app. Please take a try with the following workaround:

Set the OnStart property of the App control to following:

ClearCollect(
                 MergedCollection,
                 AddColumns(
                                     YourEntity,
                                      "Commission Ratio",
LookUp('YourSecondTable', 'Zip code' = YourEntity[@'zip code'], 'Commission Ratio') ) )

Note: The 'zip code' represents the zip code column in your Entity.

After that, you could use the MergedCollection as data source within your app, instead of your original Entity data source.

 

Please consider take a try with above solution, then check if the issue is solved.

 

More details about the LookUp function, please check the following article:

LookUp function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MaryMThompson
Level: Powered On

Re: Need Help with Calculated Fields

Yes that is how I have my 2nd list.

 

where do I use that Formula?  On the Entity, as the formula for a button on an app?

Community Support Team
Community Support Team

Re: Need Help with Calculated Fields

Hi @MaryMThompson ,

You should use above formula I provided within your PowerApps app rather than within your Entity.

 

If you added a Gallery control within your app to list all records in your Entity (posted sales invoice records), you could consider add a Label control within the Gallery, set the Text property to following:

LookUp('YourSecondTable', 'Zip code' = ThisItem.'zip code', 'Commission Ratio')

then the corresponding 'Commission Ratio' value related to specific 'Zip code' value would be shown up within your Gallery items.

 

If you want to merge your two data sources into a single one table within your app, please set the OnStart property of the App control to my above ClearCollect formula:1.JPG

then save and re-load your app, then you could use the merged table within your app as data source.

 

Based on the needs that you mentioned, I think the above solution I provided could achieve your needs. Please consider take a try with above solution, check if it could help in your scenario.

 

If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
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

MaryMThompson
Level: Powered On

Re: Need Help with Calculated Fields

I used the lookup function and was able to achieve what I needed.  Thank you

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Users Online
Currently online: 152 members 5,644 guests
Please welcome our newest community members: