Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Calculation of scores

Some help is appreciated 🙂

Please see below: 

I am trying to create Scores. Formula being sum(Numerator)/Sum(Denominator) for that specific easure name.

Cna someone help me in creating a formula using Power Query.

 

 

 

 

 

Thank you 

 

  • Hi Anonymous ,

     

    Power Query isn't really designed for creating measures such as this.

    Is there a reason why you don't want to just apply this table to your data model and create a DAX measure for it?

     

    For context, in DAX it would be as simple as:

    _score =
    VAR __numValue =
    CALCULATE(
      SUM(yourTable[Values]),
      yourTable[Measures] = "Numerator"
    )
    VAR __denValue =
    CALCULATE(
      SUM(yourTable[Values]),
      yourTable[Measures] = "Denominator"
    )
    RETURN
    __numValue / __denValue

     

    In Power Query it would likely be some significant gymnastics and an extended refresh time.

     

    Pete

2 Replies

  • Hi Anonymous ,

     

    Power Query isn't really designed for creating measures such as this.

    Is there a reason why you don't want to just apply this table to your data model and create a DAX measure for it?

     

    For context, in DAX it would be as simple as:

    _score =
    VAR __numValue =
    CALCULATE(
      SUM(yourTable[Values]),
      yourTable[Measures] = "Numerator"
    )
    VAR __denValue =
    CALCULATE(
      SUM(yourTable[Values]),
      yourTable[Measures] = "Denominator"
    )
    RETURN
    __numValue / __denValue

     

    In Power Query it would likely be some significant gymnastics and an extended refresh time.

     

    Pete

    • Anonymous's avatar
      Anonymous
      Not applicable

      Perfect!!  Thank you so much Pete 🙂 I am new to using DAX measures. But you explained in detailed way. That was really helpful.