Hi All
I am trying to do a proper DAX for my calculated column "Rep Loyality".
"Rep Loyality" should return a number of campaigns (offr_campgn_perd_id) in which representatives (acct_nr) bought any of a company's product. For instance. There are 17 campaigns each year. If a representative with her unique number "acct_nr = 123456" made 20 transactions in any 5 campaigns I should get Rep Loyality = 5 for acct_nr = 123456.
I have a idea to place "Rep Loyality" calculated column in "Rep Birth date Current Divisi" table where I have unique "acct_nr"
Part of data model:
I need to have "Rep Loyality" also for particular year. In this case YEAR =2015.
YEAR is placed in "Data - Offer Campaign Period" table.
Till now I have tried with this:
RepLoyality=
CALCULATE (
DISTINCTCOUNT ( trx_pol[offr_cmpgn_perd_id]);
ALLEXCEPT ( trx_pol; trx_pol[acct_nr]);
'Data - Offer Campaign Period'[YEAR]=2015
)
It is not really working as I expect.
Returns always "17" for each "acct_nr"
17 is a maximum nr of campaigns in a year. Not each "acct_nr" made transaction in all 17 campaigns.
"Trx_pol" is a table contains all transactions data. (120M rows)
I hope this is understandable
Any idea how to fix a DAX above?
I am trying to do a proper DAX for my calculated column "Rep Loyality".
"Rep Loyality" should return a number of campaigns (offr_campgn_perd_id) in which representatives (acct_nr) bought any of a company's product. For instance. There are 17 campaigns each year. If a representative with her unique number "acct_nr = 123456" made 20 transactions in any 5 campaigns I should get Rep Loyality = 5 for acct_nr = 123456.
I have a idea to place "Rep Loyality" calculated column in "Rep Birth date Current Divisi" table where I have unique "acct_nr"
Part of data model:
I need to have "Rep Loyality" also for particular year. In this case YEAR =2015.
YEAR is placed in "Data - Offer Campaign Period" table.
Till now I have tried with this:
RepLoyality=
CALCULATE (
DISTINCTCOUNT ( trx_pol[offr_cmpgn_perd_id]);
ALLEXCEPT ( trx_pol; trx_pol[acct_nr]);
'Data - Offer Campaign Period'[YEAR]=2015
)
It is not really working as I expect.
Returns always "17" for each "acct_nr"
17 is a maximum nr of campaigns in a year. Not each "acct_nr" made transaction in all 17 campaigns.
"Trx_pol" is a table contains all transactions data. (120M rows)
I hope this is understandable
Any idea how to fix a DAX above?
Last edited: