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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Applicable88
Impactful Individual
Impactful Individual

Calculated column and values in different rows/ get rid of row context

Hello,

I want to have a calculated column. My sample data looks like this:

 

 

DepartmentGuardsHelpers
Security  
SecurityEnough 
Security not sufficient
Security  
WarehouseEnough 
Warehouse sufficient

I already filtered the department to "security". In the background is a calculation going on to tell me if for a specific day I have enough guards and helpers or not. Unfortunately its not written in every row. And the string values of guards and value are also in different rows. 

I want another column like this: 

 

DepartmentGuardsHelpersEnough overall?
Security  No
SecurityEnough No
Security not sufficientNo
Security  No
WarehouseEnough Yes
Warehouse sufficientYes


I tried following function for calculated column :

if ( [Department]= "Security" && [Guards] = "Enough" &&  [Helpers] = "sufficient", "YES",

if ( [Department]= "Security" && [Guards] = "Enough" &&  [Helpers] = " not sufficient", "No",....... (more conditions for others departments and conditions)

 

How do I get the right values like "Yes" or "No" into every row and also correctly for every specific allocated department?

 

Thank you very much in advance. 

Best. 

2 REPLIES 2
Anonymous
Not applicable

Hi @Applicable88 

I have two situations that need to be confirmed.

(1)If [Department]= "Security" , then [Guards] = "Enough" and [Helpers] = "sufficient" must be satisfied at the same time, then return “Yes” ?

(2)If [Department]<> "Security" , then [Guards] = "Enough" and [Helpers] = "sufficient" only need to satisfy one of them, then return “Yes” ?

If the conditions meet the two situations I described above, please refer the calculated column that I provide .

Judgment = SWITCH(TRUE(),'Table'[Department]="Security" && 'Table'[Guards]="Enough" && 'Table'[Helpers]="sufficient","Yes",
                         'Table'[Department]<>"Security" && 'Table'[Guards]="Enough" || 'Table'[Helpers]="sufficient","Yes","No")     

And the result is as shown :

Ailsamsft_0-1626925369849.png

Best Regards

Community Support Team _ Ailsa Tao

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

Hello @Anonymous ,

thank you for your effort. Both guards must have enough and helpers must have sufficient to be "YES"

If one of them are either "not Enough" or not sufficient then "No".

 

I should have created alonger sample table to make it clear, to cover all cases. To make it less confusing I only use two states , which is "sufficient" and "not sufficient":

 

DepartmentGuardsHelpersFlag
Security  No
Securitysufficient No
Security not sufficientNo
Security  No
Warehousesufficient Yes 
Warehouse sufficientYes 
Subsidiary  No
Subsidiarynot sufficient No
Subsidiary  No
Subsidiary sufficientNo
Subsidiary  No
Subsidiary  No

 

I there a way to do it when both string values are not on the same row?
As long there is one "not sufficient", its definitely a "No". Only two "sufficient" for the specific department returns a "Yes". In your example the Warehouse department has both string values on the same row, thats why your switch() functions works. But in my datamodel they are mostly on different rows.

 

Thank you very much in advance.

Best. 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors