Complicated Calculated Formula Powerpivot! Help please!

DPHugo

New Member
Joined
May 12, 2014
Messages
6
hi Everyone,

It has been a while now that I am looking for an answer at this question. Maybe someone here can help me.

I am trying to compute conversion rate on consultation that my employees do to prospective clients.

I have a big table with all my invoices. One unique ID per invoices, a date creation, the name of the product billed, the revenue associated and the id profile of the client. Each of my clients have an ID (I have also a Clients table with the ID clients and all his personal info).
I do free consultation in order to close those prospective clients. For tracking purpose, I bill a 0$ invoice to each clients who book a consult. I would like to do a distinct count on id_profile who have both a consult and a productA billed.
My goal is to know for example for month of March, I have N number of consults booked whose X number that has been closed within (2 days; 30 days and so on) following the consultation date.

you will find a sample of my data attached,

Thanks in advance,

If you need more information to solve that problem, I wont be very far,


Hugo

https://docs.google.com/spreadsheets/d/1PLyKI8rg9rFLzseh23fd2uYPd8wM5vI84hV7QU07Ngw/edit?pli=1#gid=0
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
If you can get your data imported into powerpivot, I can probably help out.

How do you want me to share my powerpivot data here?

Invoiced table
id_invoiced_productdate_invoice_creationProduct_nameRevenuesid_Profile
1111/1/2014Consultation- $33
1131/2/2014Product_A1 000 $44
1151/1/2014Consultation- $55
1181/2/2014Product_A1 000 $33
1211/1/2014Consultation- $66
1241/1/2014Consultation- $77
1321/1/2014Consultation- $88
1301/2/2014Product_A1 000 $55
1331/1/2014Consultation- $99
1361/2/2014Product_A1 000 $66

<colgroup><col style="width: 100px"><col width="100"><col width="100"><col width="100"><col width="100"></colgroup><tbody>
</tbody>


Customer profil Table
id_ProfileName LAst namePrile creation dateAddress
33
44
55
66
77
88
99
111
222
333

<colgroup><col style="width: 100px"><col width="100"><col width="100"><col width="100"><col width="100"></colgroup><tbody>
</tbody>

My goal is to compute how many consultation invoices were billed in april ==> Easy it is 6 (my denominator)
Much more complicated I also want to compute how much productA I sold, relate to these 6 consultation (it can happen in april or later (my numerator) (it is 3 here for id profile 33, 55, 66)
I do not know how I can filter that in my calculate formula.

Hope it helps,

Hugo
 
Upvote 0
Well, the workbook you posted doesn't have any data actually in power pivot. I wasn't super interested in doing that import.

One way to do this would be a calculated column IsWinFromConsult, something like:

=CALCULATE(COUNTROWS(Invoices),
FILTER(ALL(Invoices),
Invoices[id_Profile] = EARLIER(Invoices[id_Profile]) &&
Invoices[Revenues] = 0 && EARLIER(Invoices[Revenues]) > 0
)
)
 
Upvote 0
Well, the workbook you posted doesn't have any data actually in power pivot. I wasn't super interested in doing that import.

One way to do this would be a calculated column IsWinFromConsult, something like:

=CALCULATE(COUNTROWS(Invoices),
FILTER(ALL(Invoices),
Invoices[id_Profile] = EARLIER(Invoices[id_Profile]) &&
Invoices[Revenues] = 0 && EARLIER(Invoices[Revenues]) > 0
)
)


Thanks you Scottsen. Earlier formula is definitly the solution to my problem.

I re-arranged the formula in order she fits my data:
Calculated Field 3:=CALCULATE(COUNTROWS(invoiced_products);filter(ALL(invoiced_products);invoiced_products[id_profile_invoiced]=earlier(invoiced_products[id_profile_invoiced])&&invoiced_products[Consult]=1&&earlier(invoiced_products[Packages]=1)))

where invoiced_products[Packages]=1 when the invoice is for my ProductA (0 when other product)
invoiced_products[Consult]=1 when the invoice is for a consultation

The formula is not working.
I get this message:
Semantic error: EARLIER / EARLIEST refers to an earlier row context which does not exist.

Do you have any idea to solve that!


Thank you so much!


Hugo
 
Upvote 0
Sounds like you are trying to do this in a measure (calculated field in 2013-speak). My intent was for this to be on a calculated column. If you need a measure we will have to figure out something else.
 
Upvote 0
Actually It doesn not matter to my if it is a calculated field or a calculated column. I just want to compute how many customer profiles have an invoice for consultation and finally get a second invoice for product A
The part in my formula which doe not work is there &&invoiced_products[Consult]=1&&earlier(invoiced_products[Packages]=1)))

I still miss something...
 
Upvote 0
I would need more details on what "not work" means, and preferably a link to your excel workbook to take a look.
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,954
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top