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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Bauhaus-Arti
Frequent Visitor

Conditional add up

Hi everybody,

I hope you can help me with the following problem. I need to calculate a total score based on the answers bewlow only i have no idea how to write the code but i do know what the end result should look like. 

 

NameQuestion 1 Question 2 Question 3
Johnyesnono
Janenoyesno

 

The goals is to add up numers based in the score, so it should look something like this:

If question 1 = yes then add 4

If question 1 = no then add 0

If question 2 = yes then add 6

If question 2 = no then add 2

If question 3 = yes then add 0

If question 3 = no then add 4

 

After the calculation the table should look like this:

NameQuestion 1 Question 2 Question 3Score
Johnyesnono10 (4+2+4)
Janenonono10(0+2+4)

 

I hope some of you could help me 🙂

1 ACCEPTED SOLUTION
rajulshah
Resident Rockstar
Resident Rockstar

Hello @Bauhaus-Arti ,

 

Please try the following DAX query:

Column =
VAR Question1 = if([Question 1]="Yes",4,if([Question 1]="No",0))
VAR Question2 = if([Question 2]="Yes",6,if([Question 2]="No",2))
VAR Question3 =if([Question 3]="Yes",0,if([Question 3]="No",4))
RETURN Question1+Question2+Question3


Hope this helps. Let me know if this didn't help.

View solution in original post

8 REPLIES 8
rajulshah
Resident Rockstar
Resident Rockstar

Hello @Bauhaus-Arti ,

 

Please try the following DAX query:

Column =
VAR Question1 = if([Question 1]="Yes",4,if([Question 1]="No",0))
VAR Question2 = if([Question 2]="Yes",6,if([Question 2]="No",2))
VAR Question3 =if([Question 3]="Yes",0,if([Question 3]="No",4))
RETURN Question1+Question2+Question3


Hope this helps. Let me know if this didn't help.

Thanks this works! This is going to be a long list sinds i have 70 questions...

You can replace these values in the column and then add all the columns! But then, you need to replace values for 70 columns.

Working on that now.

 

Do you maybe also have an idea how ignore blank answers? Is it posible to link two IF statemens together?

 

You can use NOT(ISBLANK([Column])) when calculating values.

Are you able to show what the code would look like, i cant get it to work...

Please try the following query:

Column =
VAR Question1 = if([Question 1]="Yes" && NOT(ISBLANK([Question 1])),4,if([Question 1]="No",0))
VAR Question2 = if([Question 2]="Yes" && NOT(ISBLANK([Question 2])),6,if([Question 2]="No",2))
VAR Question3 =if([Question 3]="Yes" && NOT(ISBLANK([Question 3])),0,if([Question 3]="No",4))
RETURN Question1+Question2+Question3

@Bauhaus-Arti .

 

Refer below screen shot for your reference.

Capture.JPG

Don't forgrt to hit THUMBS UP and Accept this as a solution if it helps you!

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.