Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Targeting By Frequency

Hello,

I'm a new user in Power BI and I need help to targeting users in each target. Basically we have a transactions BD with respetive user, by date. We want to define a target for each user.

 

Thanks,

Rui Luís

 

The target rules are:

TARGETRule
Lover≥ 4 transactions in 4 different weeks
Regular2 or 3 transactions
Occasionalothers

 

The transactions BD:

ID_TRANSACTIONUSERDATEWEEK
1001A02-02-20195
1002B02-02-20195
1003B02-02-20195
1004B02-02-20195
1005C10-02-20196
1006A10-02-20196
1007B10-02-20196
1008F11-02-20197
1009G11-02-20197
1010C11-02-20197
1011A20-02-20198
1012C02-03-20199
1013A03-03-20199
1014A06-03-201910
1015A07-03-201910

 

 

The expected results are:

USERTARGET
ALover
BRegular
CRegular
FOccasional
GOccasional

 

 

 

 

  • Anonymous's avatar
    Anonymous
    7 years ago

    Anonymous ,

    You could create the following Measure:

    Target = 
    var weeks = DISTINCTCOUNT(transactions[WEEK])
    var tx = COUNT(transactions[ID_TRANSACTION])
    return SWITCH(
        TRUE(),
        weeks >=4, "Lover",
        tx < 2, "Occasional",
        "Regular"
    )

    Cheers!

    Nathan

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous ,

    You could create the following Measure:

    Target = 
    var weeks = DISTINCTCOUNT(transactions[WEEK])
    var tx = COUNT(transactions[ID_TRANSACTION])
    return SWITCH(
        TRUE(),
        weeks >=4, "Lover",
        tx < 2, "Occasional",
        "Regular"
    )

    Cheers!

    Nathan