Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Count distinct based on another column value

Hello!, I´m a beginner in Power Bi and have this problem: 

I 'm filtering my Table, based on 'Articulo' Column. I need to create a new measure (to put in a card) ,equals to= 'Curva_Completa' Column/ Distinct count of Talle, only if 'Sucursal' column exists.... the result shoould be : 2/11.

 2, because we have 2 different rows (5.5 and 6) and 11 because of 'Curva_Completa' Column (it comes from an over partition from sql, so its the same value for each row from 'Articulo' Column) and. Is it possible?
Thanks in advance!

  • Hi Anonymous 

     

    Try this measure:

     

    Measure = 
    Var _A = MAX('Table'[Curva_Completa])
    Var _B = CALCULATE(DISTINCTCOUNT('Table'[Talle]),FILTER('Table','Table'[Sucursal]<>blank()))
    return
    _A/_B

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
    Appreciate your Kudos!!
    LinkedIn: 
    www.linkedin.com/in/vahid-dm/

     

     

4 Replies

  • Hi Anonymous 

     

    Try this measure:

     

    Measure = 
    Var _A = MAX('Table'[Curva_Completa])
    Var _B = CALCULATE(DISTINCTCOUNT('Table'[Talle]),FILTER('Table','Table'[Sucursal]<>blank()))
    return
    _A/_B

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
    Appreciate your Kudos!!
    LinkedIn: 
    www.linkedin.com/in/vahid-dm/

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks VahidDM , this was very helpful!! 🙂