Forum Discussion

Manuel290's avatar
Manuel290
New Member
6 years ago
Solved

Problem to use TOPN or RANKX along with a stacked column chart with age range as Legend

Hi everybody,   My problem is fairly simple in my opinion, but I've been stuck on it for quite some time. I have a table of Clients, with information such as ID, the date of their first purchase on...
  • v-alq-msft's avatar
    6 years ago

    Hi, Manuel290 

     

    You may try the following measure to see if it helps.

    Top 100 clientes por LTV por idade =
    VAR _month =
        SELECTEDVALUE ( Client[Month] )
    VAR _age =
        SELECTEDVALUE ( Clientes[Faixa etária] )
    RETURN
        CALCULATE (
            COUNT ( Clientes[ID Cliente] ),
            FILTER (
                TOPN (
                    100,
                    FILTER ( ALL ( Clientes ), Client[Month] = _month ),
                    Clientes[LTV primeiros 30 dias], DESC
                ),
                Clientes[Faixa etária] = _age
            )
        )
            / CALCULATE (
                COUNT ( Clientes[ID Cliente] ),
                TOPN (
                    100,
                    FILTER ( ALL ( Clientes ), Client[Month] = _month ),
                    Clientes[LTV primeiros 30 dias], DESC
                )
            )

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.