Forum Discussion

ING_BT's avatar
ING_BT
Helper I
4 years ago
Solved

Is this Dynamic Value segmentation?

Hello ! 

 

I am facing an issue, I'm sure the solution is simple, but lacking the knowledge I'm struggling to find the right way to do it. 

 

Here's the setup: 

I have a table with a list of "Keywords", each keyword is tracked for several brands on a weekly basis. 

So each week, for each brand, every keywords is duplicated and we get the "Rank" of the brand on the keyword. 

 

Like so: 

BrandKeywordRank

A

Label3
ATutorial2
BLabel43
BTutorial4
CLabel6
CTutorial21

(without the date (week) column in the example)

 

I want to create the followying table filtered for only one Brand

Rank IntervalsNumber of Keywords
1 to 3 123
4 to 6 234
7 to 10345
11 to 20456
21 to 49567
50+ (not ranked)678

 

The total number of keyword needs to match the total distinct number of keywords;

To do so, because the rank changes everyweek for a keywords, we need to calculate the AVERAGE rank of the keywords on the selected period and dynamicaly segment it in the right segment!

 

Keywords, rank, brand and weeks are in the same table. 

Calendar table is used.

I have created a table with intervals with min and max columns.

 

I also tried this measure (found on the community) however, it used the column "rank" as is, instead of doing an average? And thus One keyword is counted several times in several segments (if we select a 1 year date range for example)

 

Calculate (DISTINCTCOUNT('Rankings Evolution'[Keyword]),

FILTER(
    VALUES('Rankings Evolution'[Rank avg]),
        COUNTROWS(
            FILTER(Intervals,

    'Rankings Evolution'[Rank avg] >= Intervals[Min]
    && 
    'Rankings Evolution'[Rank avg] < Intervals[Max]
    ))>0))

 

 

Thank you in advance!! 

 

Best,

BT

 

  • Hi ING_BT ,

     

    Based on the description you have you need to  do a measure similar to this one:

    Count Words on ranking = 
        VAR temptable =
            SUMMARIZE (
                words,
                Words[Brand],
                Words[Keyword],
                "AVerageRanking", AVERAGE ( Words[Rank] )
            )
        RETURN
            COUNTROWS (
                FILTER (
                    temptable,
                    [AVerageRanking] <= MAX ( Ranking[End] )
                        && [AVerageRanking] >= MIN ( Ranking[Start] )
                )
            )

     

    I have added some words counts on the Brand A and has you can see the total word count is 2 always:

     

    Be aware that  this calculation is at a brand level if your try to do it with all brands at all ranking the calculation is incorrect has you can see in the Total column below 

     

     

10 Replies

  • Hi ING_BT ,

     

    Based on the description you have you need to  do a measure similar to this one:

    Count Words on ranking = 
        VAR temptable =
            SUMMARIZE (
                words,
                Words[Brand],
                Words[Keyword],
                "AVerageRanking", AVERAGE ( Words[Rank] )
            )
        RETURN
            COUNTROWS (
                FILTER (
                    temptable,
                    [AVerageRanking] <= MAX ( Ranking[End] )
                        && [AVerageRanking] >= MIN ( Ranking[Start] )
                )
            )

     

    I have added some words counts on the Brand A and has you can see the total word count is 2 always:

     

    Be aware that  this calculation is at a brand level if your try to do it with all brands at all ranking the calculation is incorrect has you can see in the Total column below 

     

     

    • ING_BT's avatar
      ING_BT
      Helper I

      Hello FĂ©lix, 

       

      Thank you so much for your help! Your solution is very clear and It works perfectly. And thank you for very detailed explanation. 

       

      I spend hours to solution this, you cannot imagine the relief! I understand the logic now (thank you for naming it "temptable", makes it so obvious now!)

      All the best,

      BT

       

      • MFelix's avatar
        MFelix
        Super User

        Hi ING_BT ,

         

        Has I refer the the calculation is made at brand level, if you need to redo this to have all the brands selected and all the words this can be changed.