Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
silverfox
Regular Visitor

Matrix table calculation in education setting.

Hi I'm new to Power Bi and Im trying to use it in a Education setting.

 

Below is the screen shot ( number 2) of the matrix table I have and would like to calculate the difference between column 1 and 2.

The data comes from a MIS in what I would describeScreen Shot 1 (Data from MIS)Screen Shot 1 (Data from MIS)Screen shot 2 (Matrix table)Screen shot 2 (Matrix table) a list form (See screen shot1) Any help with a solution would great.

 

 

 

 
 
2 ACCEPTED SOLUTIONS
v-juanli-msft
Community Support
Community Support

Hi @silverfox 

I can work wout with two kinds of visual, please let me know which you like better or anything else.

1.

Capture20.JPG

2.

Capture21.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-juanli-msft
Community Support
Community Support

Hi @silverfox 

I can work wout with two kinds of visual, please let me know which you like better or anything else.

1.

Capture20.JPG

2.

Capture21.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-juanli-msft
Community Support
Community Support

Hi @silverfox 

You could create a calculated column like

new column=[column1]-[column2],

If it doesn't work for your scenario, please let me know the columns for "row","column" and "value" field of the matrix.

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Maggie

Thanks for the reply.

 

I think because I'm pulling the data into BI a certain way it will not give the individual pivoted columns ( I'm right in thinking the matrix is really just an excel pivot table?)

 

I have the matrix set up as follows:

Student name is Rows and this is from a different data set.
Basic Details is columns and this give the subject name Geography, Geography Estimate etc
Value is result which then gives a GCSE grade.

 

The data come in the format on the second image I posted.

Hope this helps and thanks for you help.

Craig

Hi @silverfox 

My visual 2 is recommended based on my experience.

Here are steps i make it:

1. assume you table as below

Capture23.JPG

2.

In Edit queries,

Split column for "detail" column,

replace the "null" with "Actual" value,

then close&&apply, return to report view

Capture22.JPGCapture24.JPG

 

3.

Create measures in Detail table

Measure =
VAR actual =
    CALCULATE (
        SUM ( 'detail table'[Result] ),
        FILTER (
            ALLSELECTED ( 'detail table' ),
            'detail table'[student id] = MAX ( 'detail table'[student id] )
                && 'detail table'[Basic details.category] = "Actual"
        )
    )
VAR estimate =
    CALCULATE (
        SUM ( 'detail table'[Result] ),
        FILTER (
            ALLSELECTED ( 'detail table' ),
            'detail table'[student id] = MAX ( 'detail table'[student id] )
                && 'detail table'[Basic details.category] = "Estimate"
        )
    )
RETURN
    actual - estimate

Measure 2 = IF(ISINSCOPE('detail table'[Basic details.category]),SUM('detail table'[Result]),[Measure])

 

4. edit the format of the matrix->Subtotal

Capture25.JPGCapture26.JPG

Capture27.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Maggie

 

Your first version is perfect as a single page is just 1 subject. Is there way to conditionally format the difference column.

 

Many thanks again

 

Craig

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.