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
Anonymous
Not applicable

Power Query Custom Column

Hey,

 

I want the following:

 

Type of Contract - number of active employees by type of contract and employee subgroup (column BP and AY), in wich you have to consider:
Contract type "Sem termo (Permanente)" = Open Ended
Contract type "Termo Certo" = Fixed Term
Contract type "Termo Certo" + Employee Subgroup Designation "Estagio Curricular" or "Estagio ExtraCurricu" = Curr. Intern
Contract type "Termo Certo" + Employee Subgroup Designation "Estagio Profissional" = Prof. Intern

 

Does someone know how to do this with custom column?

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@Anonymous Seems like a nested if then else statement so:

if <condition> then <if true> else if <condition> then <if true> else if ...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

if [Termo do Contrato] = "Sem termo (Permantente)" then "Open Ended"

else if [Termo do Contrato] = "Termo Certo" then "Fixed Term"

else if [Termo do Contrato] = "Termo Certo" and [Dsg Sub Grupo Empr] = "Estagio Curricular" or [Dsg Sub Grupo Empr] = "Estagio ExtraCurricu" then "Curr. Intern"

else if [Termo do Contrato] = "Termo Certo" and [Dsg Sub Grupo Empr] = "Estagio Profissional" then "Prof. Intern"

else "0"

 

This gives me only '0'

Hi @Anonymous 

 

If it only gives you "0", it means all of the above conditions are not met. The [Termo do Contrato] column is of Text type, right? Check if there is any typo in the values. Maybe there is some whitespace before or after the values, which is invisible and easy to be ignored. Under Transform tab, select Format > Trim to remove the leading and trailing whitespaces.

 

And in the third condition, please use parentheses to wrap [Dsg Sub Grupo Empr] = "Estagio Curricular" or [Dsg Sub Grupo Empr] = "Estagio ExtraCurricu" part as AND has a higher priority over OR. You need to add parentheses to ensure the calculation priority. 

 

If this doesn't help, please share some dummy data or pbix which can reproduce this problem, as well as your expected result. With them, we can help look for the detailed cause. 

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

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.