Forum Discussion

abdul26's avatar
abdul26
Frequent Visitor
3 years ago
Solved

Adding both a total and an average column

I have created a marix with the following details 

 

Rows:  Category types 

Columns:   Week numbers 

Values - Values 

 

I wish to add both an average and a total column.

I am able to generate them individually but not together.

 

PowerBi provides the option of column subtotal that way I can have a total column. 

 

By using the following measure = 

IF( HASONEVALUE( week ) , [val_measure]  , AVERAGEX( VALUES( week ) ,  [val_measure]  ))     ,
I can display the average column in place of the total column.
 
How can I display both of them simultaneously.
 

 

  

6 Replies

  • v-xiaosun-msft's avatar
    v-xiaosun-msft
    Community Support

    Hi abdul26 ,

     

    According to your description, here is my solution.

    I created a sample.

    Create a measure to calculate the average value.

     

    Average = AVERAGE(Tabelle1[Value])

     

    Make sure the option followings is turned on. And then put the measure and "value" to values together. Put "value" to the first which will calculate the total.

    Note that when we put measure to "value", it will create columns under  "columns" as the screenshot shows.

    And you can refer to the following link.

    Create a matrix visual in Power BI - Power BI | Microsoft Learn

     

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ xiaosun

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