I am comparing values for a few dozen fields, this month vs. last month.
When there's a new item this month, there is no "last month field" to compare it to.
This crashes the flow when the logic tries to compare "Sales" with "Sales Previous Month"... since the Sales Previous Month field does not exist for new items.
For items with no previous month, how can I create a dynamically changing set of fields for last month, with null or zero values? I'd Append this empty set to the current month's fields.
I'd like this to be dynamic because the users likely will decide to monitor different fields as time passes.
Thanks for any help!
@Newt
Is it possible for you to provide sample input files and sample output?
Hi @Newt ,
If the column names follows a specific rules like [name] vs. [name_Previous], you can use Cross Tab as below.
Input Data
RecordID | ItemA | ItemA_Previous | ItemB | ItemB_Previous | ItemC |
1 | 10 | 11 | 20 | 22 | 10 |
2 | 20 | 22 | 40 | 42 | 20 |
3 | 30 | 33 | 60 | 62 | 30 |
4 | 40 | 44 | 80 | 82 | 40 |
5 | 50 | 55 | 100 | 102 | 50 |
Output Data
RecordID | Name | Current | Previous | Diff |
1 | ItemA | 10 | 11 | -1 |
1 | ItemB | 20 | 22 | -2 |
1 | ItemC | 10 | ||
2 | ItemA | 20 | 22 | -2 |
2 | ItemB | 40 | 42 | -2 |
2 | ItemC | 20 | ||
3 | ItemA | 30 | 33 | -3 |
3 | ItemB | 60 | 62 | -2 |
3 | ItemC | 30 | ||
4 | ItemA | 40 | 44 | -4 |
4 | ItemB | 80 | 82 | -2 |
4 | ItemC | 40 | ||
5 | ItemA | 50 | 55 | -5 |
5 | ItemB | 100 | 102 | -2 |
5 | ItemC | 50 |
Workflow
Formula Tool
[Cur_Prev] = IF EndsWith([Name], "_Previous") THEN "Previous" ELSE "Current" ENDIF
[Name] = REGEX_Replace([Name], "_Previous$", "")
I like your idea @Yoshiro_Fujimori! I used to use Python tool to address this kind of task, but now I have a much easier to do it :)
User | Count |
---|---|
106 | |
82 | |
70 | |
54 | |
40 |