Forum Discussion

Vitor_sp_bo's avatar
Vitor_sp_bo
Helper I
4 years ago
Solved

count with parameter

[ Spoiler ]
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Vitor_sp_bo ,

    Do you mean using the parameters in Power bi desktop to count, I have an example here

    I created some data:

    Custom rules:

    Use parameters to display the top N names, and calculate how many IDs the top N names in each group have.

    Here are the steps you can follow:

    1. Modeling – New parameter.

     

    2. Create measure.

    rank = RANKX(ALL('CountTable'),CALCULATE(SUM('CountTable'[Amount])),,ASC)
    count=
    COUNTX(FILTER(ALL(CountTable),'CountTable'[group]=MAX('CountTable'[group])&&[rank]<=[Parameter Value]),[group])

    3. Result:

    Best Regards,

    Liu Yang

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