Difference between Columns in Crosstab Query

stryfe3003

New member
Local time
Today, 16:33
Joined
Jul 22, 2021
Messages
3
Hi, I have a list of 10 products, say A, B, C, D...... and I log the sales of each product every day.
I created a crosstab query such that products are in the rows and columns are two dates that I specify in the query.
I wanted to find out whats the difference in sales between these two dates for each product. Eg
22 Jul 15 Jul Difference
Product A 10 3 7
Product B 15 20 -5
Product C 12 4 8

How can I create the above automatically? I have already created the userform to input the 2 dates required.
Thank you!
 
user forms dont work well with crosstabs, since the fields can change.
you should view them in datasheet only.
but you can make a 'report' table that holds generic column , append the xtab to it , and the form can show the math on columns that wont change names.
 
you need some VBA to add the Difference column.
 

Attachments

Thanks very much, how do I reference to the column headers which changes according crosstab query result? Thanks again
Have you even looked at the db arnelgp uploaded ? :(
 

Users who are viewing this thread

Back
Top Bottom