Forum Discussion

Enan's avatar
Enan
Helper I
3 years ago
Solved

Count the age Less than 18

Hi

 

I want to count the age of the players that are less than 18 years old.

I have made below measure, but it gives me error.

age<18 = CALCULATE(COUNTROWS('fct_Season 2022/2023 Transfer'),'fct_Season 2022/2023 Transfer'[Player Age]="<"&&18)
 
Need guidance to resolve.
  • Hi, Enan 

     

    You can try the following methods.
    Sample data:

    Measure = CALCULATE(COUNT('Table'[Player]),FILTER(ALL('Table'),[Age]<18))

    There is another kind.

    Measure 2 = CALCULATE(COUNT('Table'[Player]),FILTER(ALL('Table'),[Player Age]="<18"))

    Is this the result you expect?

    Best Regards,

    Community Support Team _Charlotte

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

2 Replies

  • MahyarTF's avatar
    MahyarTF
    Memorable Member

    Hi,

    I think there is a syntax error on (="<"&&18) part, try the below code Please :

    age<18 = CALCULATE(COUNTROWS('fct_Season 2022/2023 Transfer'),'fct_Season 2022/2023 Transfer'[Player Age]18)

    Thanks for your Kudos and please mark it as a solution if it helps

  • v-zhangti's avatar
    v-zhangti
    Community Support

    Hi, Enan 

     

    You can try the following methods.
    Sample data:

    Measure = CALCULATE(COUNT('Table'[Player]),FILTER(ALL('Table'),[Age]<18))

    There is another kind.

    Measure 2 = CALCULATE(COUNT('Table'[Player]),FILTER(ALL('Table'),[Player Age]="<18"))

    Is this the result you expect?

    Best Regards,

    Community Support Team _Charlotte

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