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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

creating a new column based on filtering from 3 other columns

Hi all,

 

I am relatively new to Power Bi, so the answer to my question may be something simple but I cannot figure it out.

 

I have a table where I have created 3 separate columns which are showing information based on defined conditions.

Now I would like to create another (4th column) which will be filtered based on the previous columns:

Endjoy1_0-1619169496756.png

the idea is if the raws in the 3 columns are "-" for the result to be filtered as "-" in the last column. If the values are all"yes", the result to be "yes" and if there is even one "no" the result to be "no".

I tried creating a custom column which did not work. Help would be greatly appreciated.

thanks

Martin

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous  ,

Here are the steps you can follow:

1. Create calculated column.

 

KPI Overall =
var _yes=IF([Delivery KPI PC]="Yes",1,0)+IF([Delivery KPI Print]="Yes",1,0)+IF([Delivery KPI DJ]="Yes",1,0)
var _no=IF([Delivery KPI PC]="No",1,0)+IF([Delivery KPI Print]="No",1,0)+IF([Delivery KPI DJ]="No",1,0)
return
SWITCH(
    TRUE(),
    _yes+_no=0,"-",
    _no=1,"No",
    _yes=3,"Yes",
    BLANK())

 

2. Result.

v-yangliu-msft_0-1619591159944.png

 

 

Best Regards,

Liu Yang

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

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous  ,

Here are the steps you can follow:

1. Create calculated column.

 

KPI Overall =
var _yes=IF([Delivery KPI PC]="Yes",1,0)+IF([Delivery KPI Print]="Yes",1,0)+IF([Delivery KPI DJ]="Yes",1,0)
var _no=IF([Delivery KPI PC]="No",1,0)+IF([Delivery KPI Print]="No",1,0)+IF([Delivery KPI DJ]="No",1,0)
return
SWITCH(
    TRUE(),
    _yes+_no=0,"-",
    _no=1,"No",
    _yes=3,"Yes",
    BLANK())

 

2. Result.

v-yangliu-msft_0-1619591159944.png

 

 

Best Regards,

Liu Yang

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

Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the sample pbix file's link down below.

I could not know the condition of the result if there is only one yes, so I just flagged it as "check again".

 

The below is for the column creation.

 

Picture13.png

 

New Column =
SWITCH (
TRUE (),
'Table'[Delivery KPI PC] = BLANK ()
&& 'Table'[Delivery KPI Print] = BLANK ()
&& 'Table'[Delivery KPI DJ] = BLANK (), BLANK (),
'Table'[Delivery KPI PC] = "yes"
&& 'Table'[Delivery KPI Print] = "yes"
&& 'Table'[Delivery KPI DJ] = "yes", "yes",
'Table'[Delivery KPI PC] = "no"
|| 'Table'[Delivery KPI Print] = "no"
|| 'Table'[Delivery KPI DJ] = "no", "no",
"check again"
)
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: https://www.linkedin.com/in/jihwankim1975/

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.