Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
LukaDon77
Contributor II
Contributor II

Month vs Month indicator

Hi Guys, 

I have a requirement for using a vizlib table to create an indicator based on month to month comparison


So there are two date fields, the actual_date that consists of the past two months, 09/20 and 08/20. Each month a new month is added but for now we only have these two months. Then we have manufactured date for the products. So we need to make make a table for products and their manufactured date, one based on latest actual_date and one based on prev actual_date. So the table for the previous actual_date would be like:

 

ProductManufactured Date 
A4/16/18
B2/5/17
C3/14/16

 

and the table for the current actual_date would be like:

ProductManufactured Date
A1/16/15
B5/9/18
C3/14/16

 

So the table below would be the manufactured date of products based on previous vs current actual_date field. We are needing to create a indicator, just a background color on CURR to compare whether the manufactured date for a product in the current actual_date is sooner or later than the manufactured date  the previous actual date

ProductManufactured Date (PREV)Manufactured Date (CURR)
A4/16/181/16/15
B2/5/175/9/18
C3/14/163/14/16

 

 

However, the expression i've tried to use isn't working, I am only getting white background color. I had created two variables vCurrentMonth (max(actual_date)) for the current actual_date and vPreviousMonth (=Date(Monthstart(Date(Date#(Max(actual_date),'MM-YYYY'),'MM-YYYY'))-1,'MM/YY'))

for the previous actual_date and had created this expression: 

 

if(only({<Actual_date={$(vCurrentMonth)}>}Manufactured_Date) > only({<Actual_Date={$(vPreviousMonth)}>}Manufactured_Date), Green(),
if(only({<Actual_date={$(vCurrentMonth)}>}Manufactured_Date) < only({<Actual_Date={$(vPreviousMonth)}>}Manufactured_Date), Red(), White()))

 

As mentioned I am only getting white background cells when that shouldn't be the case. What am I doing wrong?

Labels (4)
7 Replies
avinashelite

Did not understood completely !! Could you share the full sample data set ?  and is your data is getting overwritten every month ? if yes where your storing the previous months data 

LukaDon77
Contributor II
Contributor II
Author

Hello @avinashelite , Here is the sample report. Let me know of any issues

And data is not being overwritten every month 

LukaDon77
Contributor II
Contributor II
Author

Hi @avinashelite 

 

Was just wanting to follow up regarding this. Any issues? 

avinashelite

I haven't got a chance to check, currently I'm outside. Will revert once I get a chance to check 

avinashelite

check the attachment for the solution 

LukaDon77
Contributor II
Contributor II
Author

Hi @avinashelite , 

 

Thanks a lot for the help! I had tried what you had done, and inserted an extra condition, using the word 'same' for when the dates are equal. However, for some reason the indicator is displaying 'same' for all the values. In my data, there is at least one - two values that differ from previous month to current month, but even for those values the indicator is showing 'same'. Is there a reason for this?

avinashelite

Could you share your expression?