The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I have the below code and in this part AND and OR part is not working.KIndly help
if [Control]="ENG0N" and ([SubControl]="ENG0N.A6" or
[SubControl]="ENG0N.IPE")
then [Month]&[Year]&[SubControl]
else if [Control]="ENG0N" and ([SubControl]<>"ENG0N.A6" or
[SubControl]<>"ENG0N.IPE")
then [Month]&[Year]&[SubControl]
else null
can anyone please help me
Solved! Go to Solution.
I completely agree with this solution but somehow in some cases the combination of OR and <> is not working properly. In my case, for some blocks its working and for some its not though the logic is same. So, instead of OR and <> I have used nested if else again.
Thanks,
Shweta
No..its zero...it's sample data. All columns are text. OR operator working in some cases and in some cases it's not working.
Hi @Anonymous ,
Please try:
= if [Control]="ENG0N" and ([SubControl]="ENG0N.A6" or
[SubControl]="ENG0N.IPE")
then [Month]&Text.From([Year])&[SubControl]
else if [Control]="ENG0N" and ([SubControl]<>"ENG0N.A6" or
[SubControl]<>"ENG0N.IPE")
then [Month]&[Week]&Text.From([Year])&[SubControl]
else null
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
I completely agree with this solution but somehow in some cases the combination of OR and <> is not working properly. In my case, for some blocks its working and for some its not though the logic is same. So, instead of OR and <> I have used nested if else again.
Thanks,
Shweta
@Anonymous
Can you please share sample data and the output that you are getting?
Below is the screenshot
Basically if its A6 and IPE I dont want to concatenate week else include week in the concatenation.
I have given expected output. Error which I am facing is for all A field I am getting week in the concatenated field.
Apologies,posting the rith screenshot(chnaged B field)
Criteria is to check B field first and if it matches then check A field for A6 and IPE and do the concatenation.
Kindly help..I have to do this in power query
Hi @Anonymous ,
Are there any spelling errors in these positions? Try replacing 0 with o.
if [Control]="ENGON" and ([SubControl]="ENGON.A6" or
[SubControl]="ENGON.IPE")
then [Month]&[Year]&[SubControl]
else if [Control]="ENGON" and ([SubControl]<>"ENGON.A6" or
[SubControl]<>"ENGON.IPE")
then [Month]&[Year]&[SubControl]
else null
Note that the type of each column must be text in order to use the & link.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum