Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
How do i write a DAX Measure based on specific text in "car sales"column and return a desired value in the "region" column.
e.g. car sales containing italy, france, germany should all return europe in the region column. Thanks in advance
Solved! Go to Solution.
It is easy and best pratice to do it using Power Query
It can also be done in DAX but is is much harder and slower ... much better to use Power Query
see
https://www.youtube.com/watch?v=Vc7A6WiwLwg
Thanks for reaching out for help.
I put in a lot of effort to help you, now please quickly help me by giving kudos.
Remember we are unpaid volunteers and here to coach you with Power BI and DAX skills and techniques, not do the users job for them. So please click the thumbs up and accept as solution button.
If you give someone a fish then you only give them one meal, but if you teach them how to fish then they can feed themselves and teach others for a lifetime. I prefer to teach members on this forum techniques rather give full solutions and do their job. You can then adapt the technique for your solution, learn some DAX skills for next time and soon become a Power BI Super User like me.
One question per ticket please. If you need to extend your request then please raise a new ticket.
You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you !
@CLANG10 is this going to scale? Like are you going to have more countries?
There is a simple way to do this in dax but you have to write each country individually. It would loke something like this:
SWITCH(TRUE(),
CONTAINSSTRING(Table[CAR SALES],"ITALY") ||
CONTAINSSTRING(Table[CAR SALES],"FRANCE") ||
CONTAINSSTRING(Table[CAR SALES],"GERMANY") ,"EUROPE",
CONTAINSSTRING(Table[CAR SALES],"CHINA") ||
CONTAINSSTRING(Table[CAR SALES],"INDIA") ||
CONTAINSSTRING(Table[CAR SALES],"SINGAPORE"), "ASIA",
CONTAINSSTRING(Table[CAR SALES],"USA") ||
CONTAINSSTRING(Table[CAR SALES],"CANADA"), "AMERICA",
"(ELSE VALUE)"
)
@CLANG10 is this going to scale? Like are you going to have more countries?
There is a simple way to do this in dax but you have to write each country individually. It would loke something like this:
SWITCH(TRUE(),
CONTAINSSTRING(Table[CAR SALES],"ITALY") ||
CONTAINSSTRING(Table[CAR SALES],"FRANCE") ||
CONTAINSSTRING(Table[CAR SALES],"GERMANY") ,"EUROPE",
CONTAINSSTRING(Table[CAR SALES],"CHINA") ||
CONTAINSSTRING(Table[CAR SALES],"INDIA") ||
CONTAINSSTRING(Table[CAR SALES],"SINGAPORE"), "ASIA",
CONTAINSSTRING(Table[CAR SALES],"USA") ||
CONTAINSSTRING(Table[CAR SALES],"CANADA"), "AMERICA",
"(ELSE VALUE)"
)
Thank You! I'll build on from there.
It is easy and best pratice to do it using Power Query
It can also be done in DAX but is is much harder and slower ... much better to use Power Query
see
https://www.youtube.com/watch?v=Vc7A6WiwLwg
Thanks for reaching out for help.
I put in a lot of effort to help you, now please quickly help me by giving kudos.
Remember we are unpaid volunteers and here to coach you with Power BI and DAX skills and techniques, not do the users job for them. So please click the thumbs up and accept as solution button.
If you give someone a fish then you only give them one meal, but if you teach them how to fish then they can feed themselves and teach others for a lifetime. I prefer to teach members on this forum techniques rather give full solutions and do their job. You can then adapt the technique for your solution, learn some DAX skills for next time and soon become a Power BI Super User like me.
One question per ticket please. If you need to extend your request then please raise a new ticket.
You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you !
Hi, I got my data from datahub and i'm not able to access to the transform data power query, how to do this using DAX?
See above learning links with examples on how to do it in Dax.
I wont build the exact solution for you. I will just provide links how to learn. You need to learn to do your own job.
Sure Thanks!
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.