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

Converting Excel Formula to Power BI

Hi All,

 

Need assistance in converting this excel function to Dax  Power Bi. 

Also, if anyone can help me to simplify the excel function it woudl be great as well

 

=IF(SUMPRODUCT(--ISNUMBER(SEARCH({"WELCOME","SUBSCRIBER","WELLCOME","WECOME"},M2)))=1,"WELCOME",IF(SUMPRODUCT(--ISNUMBER(SEARCH({"NHS","KEYWORKER","KEY WORKER"},M2)))=1,"NHS/KEYWORKER",IF(SUMPRODUCT(--ISNUMBER(SEARCH({"STAFF"},M2)))=1,"STAFF","NO VOUCHER")))

 

output:

True="WELCOME", "NHS/KEYWORKER", "STAFF"

False="NO VOUCHER"

 

Thank you a lot!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

I think you use my code above to create a measure. I can reproduce the error in my side.

RicoZhou_0-1657697459356.png

As I mentioned above, the code above should be used to create a calcualted column, instead of a measure. Measure will not be load to data model, it will return results only you add it into visual.

RicoZhou_2-1657697673481.png

For more details about measure and calculated column, you may refer to this blog.

If you still want to create a measure, you can try this code. You need to use MAX() function to catch text type value.

RicoZhou_1-1657697619115.png

 

Best Regards,
Rico Zhou

 

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

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

I suggest you to try this code to create a calculated column.

Convert Formula = 
SWITCH (
    TRUE (),
    'Table'[M Column in Excel] IN { "WELCOME", "SUBSCRIBER", "WELLCOME", "WECOME" }, "WELCOME",
    'Table'[M Column in Excel] IN { "NHS", "KEYWORKER", "KEY WORKER" }, "NHS/KEYWORKER",
    'Table'[M Column in Excel] IN { "STAFF" }, "STAFF",
    "NO VOUCHER"
)

Result is as below.

RicoZhou_0-1656661703497.png

 

Best Regards,
Rico Zhou

 

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

 

Anonymous
Not applicable

Hi @Anonymous 

 

Thank you for your help.

I tried the solution you give me but I got into issue saying "A single value for column 'M Column' in table 'Table' cannot be determined. Do you have any idea how can I sort it out?

 

Thank you.

Anonymous
Not applicable

Hi @Anonymous ,

 

I think you use my code above to create a measure. I can reproduce the error in my side.

RicoZhou_0-1657697459356.png

As I mentioned above, the code above should be used to create a calcualted column, instead of a measure. Measure will not be load to data model, it will return results only you add it into visual.

RicoZhou_2-1657697673481.png

For more details about measure and calculated column, you may refer to this blog.

If you still want to create a measure, you can try this code. You need to use MAX() function to catch text type value.

RicoZhou_1-1657697619115.png

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.