cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Frequent Visitor

## Calculating differences

I have recently starting using Power BI in my school to analyse data. One thing I am trying to user it to replace is showing differences between types of students on certain KPI's

For example I have a table that shows male and female showing various KPI's and I want to create a difference column at the end

The KPI's are calculated measures.

 KPI Male Female Difference %4+Ebacc 45.56% 68.83% -23.37% %5+Ebacc 23.33% 46.75% -23.42%

I also want to be able to change the student type so that one table might show gender, another Special Education Needs types, another ethnicity etc.

Any help for a complete Power BI beginner will be appreciated.

1 ACCEPTED SOLUTION
Community Support

Hi @jonlloyd ,

You can refer to this post. This will help you solve the problem

Best Regards,

Liang

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

6 REPLIES 6
Community Support

Hi @jonlloyd ,

Based on your description, you want to calculate a new measure based on KPI. You can learn about the basic features of DAX, as well as the "DIVIDE" function and the "VAR" function.

You can refer to this sample of DAX:

``````Measure =
var sum_stu = MAX('Table'[Column1])+MAX('Table'[Column2])
var cur_count = MAX('Table'[Column1])
return DIVIDE(cur_count,sum_stu)``````

Best Regards,

Liang

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

Frequent Visitor

Thank you for the info, but I can't get the formula to work. Do I need to replace the 'Table' [column1] part with my own data tables?

On my data tables the information for column 1 and 2 is stored in the same column in my data table so does that make a difference?

sorry for my stupidity I'm still trying to figure out DAX formulas.

Community Support

Hi @jonlloyd ,

The formula I gave you is just a sample. You need to use your own table and column names.  Or you can provide your sample data and expected result. So we can help you solve the problem more effectively

Best Regards,

Liang

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

Frequent Visitor

Unfortunately, I can't provide an example of my data as its all live student data with too much personal information on it to share. Is there anything else I can provide you that maybe of use to help me with my problem?

The KPI's are all calculated measures, and the gender of the student is in the same column with a row for each student in the table but is acting as a filter on a matrix table. I want the difference value to appear as an additional column Hopefully the screenshot below may help

Community Support

Hi @jonlloyd ,

You can refer to this post. This will help you solve the problem

Best Regards,

Liang

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

Super User

Should just have to create a measure like:

Difference = [Measure1] - [Measure2]

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

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

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors