Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
canmarroig
Partner - Creator
Partner - Creator

Card holders analysis

I'm attempting to create a set of dashboards for card analysis. I've a list of cards with they profile (silver, gold...). My card holders can upgrade or downgrade their profile making certain actions, on db i've the date when it happened, i need to find in a certain period (two variables in a input box) how many silver cards became gold and how many gold cards became silver. Here attached an example. Can you help me, pls? Tks

1 Solution

Accepted Solutions
Gysbert_Wassenaar

If you create two extra fields in the script you can easily calculate this. See attached example.

Temp:

LOAD Code,

     Profile,

     Month,

     Year,

     Coins

FROM

profile.xls

(biff, embedded labels);

Result:

load *,

    if(previous(Code)=Code and previous(Profile) <> Profile,

        if(previous(Profile)  = 'Gold' and Profile = 'Silver', 'Downgrade', 'Upgrade')) as Change,

    date(MakeDate(Year, Month),'M-YYYY') as Date

Resident Temp

order by Code, Year, Month;

drop table Temp;


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

If you create two extra fields in the script you can easily calculate this. See attached example.

Temp:

LOAD Code,

     Profile,

     Month,

     Year,

     Coins

FROM

profile.xls

(biff, embedded labels);

Result:

load *,

    if(previous(Code)=Code and previous(Profile) <> Profile,

        if(previous(Profile)  = 'Gold' and Profile = 'Silver', 'Downgrade', 'Upgrade')) as Change,

    date(MakeDate(Year, Month),'M-YYYY') as Date

Resident Temp

order by Code, Year, Month;

drop table Temp;


talk is cheap, supply exceeds demand
canmarroig
Partner - Creator
Partner - Creator
Author

Thank you, I was studing a way to solve in front end but script is easier.