Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Summarizing the data in months intervals

GauravRawal
8 - Asteroid

Hi All,

 

I am having a data as attached below for each date in asset_changedate column. What i am trying to achieve is to group the data by asset number and asset status,by dividing the changedate in month intervals, starting from the present date, for any number of past years.

 

For ex, I need to find the total number of ACTIVE status rows for an asset in last month(starting from the present date when the flow runs), and then total number in previous month and so on.... And similarly for other statuses.

 

How could i achieve this?

 

asset_numberasset_statusasset_changedate
1280481008ACTIVE5/22/2016 0:00
1280481008ACTIVE5/24/2016 0:00
1280481008ACTIVE5/26/2016 0:00
1280481008ACTIVE5/28/2016 0:00
1280481008ACTIVE5/30/2016 0:00
1280481008OOS9/11/2016 0:00
1280481008OOS9/13/2016 0:00
1280481008OOS9/15/2016 0:00
1280481008OOS9/17/2016 0:00
1280481008OOS9/19/2016 0:00
80920OOS8/5/2016 0:00
80920OOS8/7/2016 0:00
80920OOS8/9/2016 0:00
80920OOS8/11/2016 0:00
80920OOS8/13/2016 0:00
80920ACTIVE8/15/2016 0:00
80920ACTIVE8/17/2016 0:00
80920ACTIVE8/19/2016 0:00
80920ACTIVE8/21/2016 0:00
80920ACTIVE8/23/2016 0:00

 

 

3 REPLIES 3
NicoleJohnson
ACE Emeritus
ACE Emeritus

Here's an option:

 

  1. I would start by bringing in the DateTimeNow input tool (In/Out category). This will update the date you're using to compare to today's date whenever the workflow is run. (Make sure you change the format to the standard yyyy-mm-dd format for ease of use later in the workflow.)
  2. Append the date to your data (before or after filtering for Status = ACTIVE) using the Append Tool
  3. Convert [asset_changeddate] to the proper date format (I did this in a formula, but you could also use the DateTime tool in the Parse category of tools)
  4. Calculate the difference between today's date & asset_changeddate using this formula: DateTimeDiff([DateTimeNow],[asset_changedate],"months")
  5. Use the Summarize Tool to Group By DateDifference (i.e. number of months in the past) and then Count the same field to see the total # of Active assets for each "Months Ago" group

In this example, "0" months will be assets that changed in the last month, then "1" will be from the month prior, etc. Month difference should be calculating based on the same day in the comparison month, so if you wanted to use a standard 28 days or something, you'd need to change from "months" to "days" and divide by your standard day count, etc.

 

Take a look at the attached workflow - I added a few more dates to check that it was working, seems to get the results you're looking for! Let us know if that works. Otherwise might help to see a sample of what you expect the output to look like? Thanks!

 

NJ

GauravRawal
8 - Asteroid

Hello Nicole,

 

Thanks for your inputs. It got me the output i needed. 

 

Could there be a way to group the data per month wise also, for the same set of data?

 

For ex, if today is 24th May. I get the count of ACTIVE status in 24 days of May, April, March and so on, for past years data.

 

Thanks,

Gaurav

GauravRawal
8 - Asteroid

Got this working. 

 

Thanks.

Labels
Top Solution Authors