I have data set with Location and sales value coming from two different sources. I need to report gap for these values. For example,
Data Set A
Location | Jan-24 | Feb-24 | Mar-24 | …. | Mar-25 |
X | 782 | 896 | 111 | 467 | 623 |
Y | 586 | 361 | 126 | 297 | 175 |
Z | 355 | 195 | 759 | 183 | 965 |
Data Set B
Location | B Jan-24 | B Feb-24 | B Mar-24 | …. | B Mar-25 |
X | 92 | 868 | 758 | 798 | 57 |
Y | 491 | 656 | 521 | 836 | 825 |
Z | 275 | 570 | 696 | 736 | 134 |
Result should be (month wise subtract Data B from A)
Location | Jan-24 | Feb-24 | Mar-24 | …. | Mar-25 |
X | 690 | 28 | -647 | -331 | 566 |
Y | 95 | -295 | -395 | -539 | -650 |
Z | 80 | -375 | 63 | -553 | 831 |
Solved! Go to Solution.
Hey Ronit Gupta,
To achieve the month-wise subtraction (A - B) between two datasets like in your image, here's how you can handle it in Alteryx step-by-step:
Step-by-Step Solution in Alteryx
Join on Location.
This will give you:
Left: Data Set A
Right: Data Set B (renamed to match A)
[Jan-24] - [Jan-24 (Right)]
[Feb-24] - [Feb-24 (Right)]
...
[Mar-25] - [Mar-25 (Right)]
Use the Select Tool to drop unnecessary original columns if needed.
Output the final result using the Browse or Output Data Tool.
Hope this solution helps you make the most of Alteryx! If it did, click 'Mark as Solution' to help others find the right answers.
💡Found it helpful? Show some love with kudos as your support keeps our community thriving!
🚀Let’s keep building smarter, data-driven solutions together! 🚀
@GrowthNatives , I have data from 2022 that needs to be analyzed. Is there a dynamic way to compare the two columns? Also it needs to be done with other key figures.
@Ronit_Gupta one way of doing this
If you need to compare year-over-year data (like 2022 vs 2023) across multiple key figures dynamically, here's a simple and scalable approach in Alteryx.
Group by Location and Metric.
Set Year as column headers and Value as data values.
This creates side-by-side year columns like 2022, 2023.
[2023] - [2022]
([2023] - [2022]) / [2022] * 100
This method works across all metrics dynamically and avoids manual handling of each column.
Hope this solution helps you make the most of Alteryx! If it did, click 'Mark as Solution' to help others find the right answers.
💡Found it helpful? Show some love with kudos as your support keeps our community thriving!
🚀Let’s keep building smarter, data-driven solutions together! 🚀
@binuacs thanks, I am stuck at Diff macro. Unable to get location field as output
@Ronit_Gupta make sure the dynamic select has the below expression
@binuacs Yes, select tool is the same but maybe input needs to be changed. Input for macro needs to be static file? it is output of join tool.
If your column names are different then update the macro accordingly, for example if column Location is different name in your input file you need to update the macro or provide actual column names I will update the flow
User | Count |
---|---|
52 | |
27 | |
25 | |
24 | |
21 |