At the top of the last page, the matrix shows the average revenue and basket value generated by two selected products over the days of the week and times of the day.
To increase the significance of this matrix, a next step could be to calculate the relative amount of revenue compared to the total revenue. Thereby outliers would be easier to detect. Additionally, one could think about adding filters to only analyze a subset of data, e.g. only a specific period of time.
At first, we get all transactions where both products were sold together. For these transactions, we calculate the basket value and select the weekday and hour. Afterwards, we add the basket values and count the number of transactions for each weekday and hour. This calculation happens on each partition. Following, the average basket value is computed.