Forum Discussion

Charu's avatar
Charu
Icon for Post Patron rankPost Patron
8 years ago

How to use both Avg and sum function in DAX

Hi Everyone,

 

I have 4columns like below

Col1 : Col2 : Col3 : Col4

0         0       1         0

I want to first sum these 4 columns and then need to get Average.

Please help me how to create DAX formula

 

In KPI Visual I need to use that Avg measure in the Target Label

6 Replies

  • Do you want sum Col1 + Col2 + Col3 + Col4 and make a average this sum?

     

    If so, then:

    Measure:= AVERAGEX(Tab1;[Col1]+[Col2]+[Col3]+[Col4])
    • Charu's avatar
      Charu
      Icon for Post Patron rankPost Patron

      HI PietroFarias

      I tried the measure but I'm getting following error

      Error Message:
      ORA-00904: "t1"."QTR2_TARGET": invalid identifier. The exception was raised by the IDbCommand interface.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Charu,

        Do you connect to Oracle in Power BI Desktop? Could you please post a screenshot about how you apply PietroFarias's DAX in your table?

        Regards,
        Lydia

  • jcarville's avatar
    jcarville
    Icon for Skilled Sharer rankSkilled Sharer

    You can unpivot the 4 columns to create 1 column. Then use this new column and change the type to sum or average using the drop down arrow under the values section of the visualisations pane.