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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
blessedberry
New Member

Combining multiple if statements with sum and subtract

Dear community,

 

I am relatively new to Power BI and I am trying to create a measure that will help me calculate a national student score based on the high school level recommendation they were given in elementary school. 

High school level recommendation in our country (Netherlands) is ranked as follows (starting from low to high). There can also be a mixed advice (see 3, 5, 7, 9). I have already made an index column with this exact numbering. 

1. pro

2. vmbo b

3. vmbo b / vmbo k

4. vmbo k

5. vmbo k / vmbo (g)t

6. vmbo (g)t

7. vmbo (g)t / havo

8. Havo

9. Havo / vwo

10. Vwo 

 

The national student score is calculated using the students current high school level in year number 3 by the following conditions. 

1. If the student is currently in a lower high school level than was recommended at elementary school, the score is -1,0. 

2. If the student has a mixed recommendation and achieves the lowest of the two, the score is 0,0.

3. If the student has a mixed recommendation and achieves the highest of the two, the score is 1,0.

4. If a student is currently in a higher high school level than was recommended at elementary school, the score is +1,0.

5. If the student has havo recommendation and is currently at havo/vwo level, the score is +0,5.

 

Below is an example of an imaginary school and students. In the first column are the recommendations, and in the 2nd to 7th column are the number of students that achieved the corresponding high school level.

 

I am trying to achieve the following as the national student score is dependant on the recommendation that is given. Using an index table; 

IF recommendation = 1(pro),  then the sum of every table (since it is a higher level) is added. 

IF recommendation = 2(vmbo b), then the sum of vmbo k, vmbo (g)t, havo, havo/vwo and vwo is added since the count of vmbo b is neutral.

IF recommendation = 3(vmbo b/ vmbo k), then the sum of vmbo k, vmbo (g)t, havo, havo/vwo and vwo is added since the count of vmbo b is neutral.

IF recommendation = 4(vmbo k), then the sum of vmbo (g)t, havo, havo/vwo and vwo is added since the count of vmbo k is neutral. This sum is then subtracted by the count of vmbo b, because this is a lower level. 

and so on.

 

I want to write a specific measure that takes into account all these calculations per row. The national student score column should then contain a specific score per recommendation. See column 8 for the desired result. 

 

Recommendationvmbo bvmbo kvmbo (g)thavohavo/vwovwoNational student score (desired result)
vmbo k0010001
vmbo k / (g)t0020002
vmbo (g)t / havo0079190120
havo0027107023-4
havo/vwo002201-1
vwo001160139-17

 

I am very much looking forward to any tips that can guide me in the right direction.

 

Many thanks,

 

S

1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data that fully covers your issue, including all possible combinations..
Please show the expected outcome based on the sample data you provided.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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