Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi All,
I have table with muliple columns inlcusing the below two:
| Event | Type |
| AAA | Cust123 |
| BBB | Cust123 |
| AAA | CP |
| BBB | CP |
| AAA | B2B |
| BBB | B2B |
now based on the above two column I want a third column named NewType which should ideally be:
| Event | Type | NewType |
| AAA | Cust123 | Customer |
| BBB | Cust123 | Other |
| AAA | CP | Partner |
| BBB | CP | Partners |
| AAA | B2B | Top |
| BBB | B2B | OtherTop |
What DAX should I write to achieve the above third column?
Solved! Go to Solution.
Hi @Shaji ,
You can use SWITCH also
SWITCH(
TRUE(),
Table'[Event] = "AAA" && Table[Type] = "Cust123", "Customer",
Table'[Event] = "BBB" && Table[Type] = "Cust123", " Other Customer"
)
Regards
HN
@Shaji , you can use Switch True.
https://radacad.com/write-conditional-statement-using-switch-in-dax-and-power-bi
I see that the SWITCH true statement only checks single column value. In my question I need to check Two COlumns and then print the results.
Hi @Shaji ,
Can you share the logic of the 3rd Column.
How do you identify if he is a customer, partner or others.
Regards,
HN
So basicall we have two type of Event. IN the example it is AAA and BBB. And for each event there is a set of "Type" which will be common to both AAA and BBB.
So now if Event = AAA and Type=Cust123 i should get the NewType = Customer
similarly if Event = BBB and Type=Cust123 i should get the NewType = Other
So based on Column Event and Type I should get the result in NewType.
Hope you can get some idea on what I am looking for
Hi @Shaji ,
Not sure how will you replace Cust123 with Customer, etc... How many combinations like this do you have.
You can try this.
Hi @Shaji ,
You can use SWITCH also
SWITCH(
TRUE(),
Table'[Event] = "AAA" && Table[Type] = "Cust123", "Customer",
Table'[Event] = "BBB" && Table[Type] = "Cust123", " Other Customer"
)
Regards
HN
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 57 | |
| 34 | |
| 33 | |
| 18 | |
| 16 |
| User | Count |
|---|---|
| 65 | |
| 65 | |
| 44 | |
| 30 | |
| 29 |