Search code examples
powerbidaxaveragemin

How does one calculate the minimum & average by row over multiple columns in Power BI DAX


I am having a hard time writing DAX to calculate the average of aggregated averages by row and column. I also, am not having luck writing DAX to calculate the minimum of the aggregated averages by row. This is how my data is structured:

Raw Data

These tables represent what the data looks like aggreated (Table 1) and what the desired output is (Table 2).

Desired Results

Can anyone help? Please let me know if you need further clarification.


Solution

  • Try the following three Measures:

    Avg by Date = 
      AVERAGEX(
        DISTINCT('YourTable'[Department]),
        CALCULATE(AVERAGE(YourTable[Value]))
      )
    
    
    Min Avg by Date = 
      MINX(
        DISTINCT('YourTable'[Department]),
        CALCULATE(AVERAGE(YourTable[Value]))
      )
    
    
    Avg of Avg by Date = 
      CALCULATE(
        AVERAGEX(
          DISTINCT('YourTable'[Date]),
          [Avg by Date]
        ),
        ALLSELECTED('YourTable'[Date])
      )
    

    enter image description here