Forum Discussion

ruxandraalina's avatar
4 years ago
Solved

Matrix with both total and average

Hello!

 

I need to create a matrix that shows monthly values (a count of tickets) by category, totals by category and averages by category, as below.

Months are to be selected from a slicer, so this is only an example. 

 

CategoryJanuaryFebruaryMarchTotalAverage
A582155.00
B656175.67
C368175.67
D121373210.67
E1545248.00

 

I've tried using the switch formula and it does work for monthly values, but i can't get the total and the average. 

 

If anyone could help, that would be much appreciated!

 

Thank you!

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi ruxandraalina ,

     

    In this case, there are two values in the matrix, one calculated as the sum and one sum calculated as the average. Each value is pivoted, so that two values appear in each column of the matrix.

     

    My idea is to hide the unwanted values, like this.

    Here the Total column I am turning on the column subtotal and the average is adding the measure to the value.

    Average = 
    VAR _count_c = COUNT('Table'[Category])
    VAR _count_m =DISTINCTCOUNT('Calendar'[Month])
    VAR _result = DIVIDE(_count_c,_count_m)
    RETURN
    _result

    The PBIX file is attached for reference.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ruxandraalina ,

     

    In this case, there are two values in the matrix, one calculated as the sum and one sum calculated as the average. Each value is pivoted, so that two values appear in each column of the matrix.

     

    My idea is to hide the unwanted values, like this.

    Here the Total column I am turning on the column subtotal and the average is adding the measure to the value.

    Average = 
    VAR _count_c = COUNT('Table'[Category])
    VAR _count_m =DISTINCTCOUNT('Calendar'[Month])
    VAR _result = DIVIDE(_count_c,_count_m)
    RETURN
    _result

    The PBIX file is attached for reference.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data