Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi all,
I am trying to create calculated column in Power BI report.
When,
If State column = " NSW" & First Char of Customer name column = (Present between)"A to F" Then assign name of executive as John,
If State column = " NSW" & First Char of Customer name column= (Present between)"G to K" Then assign name of executive as Kevin,
If State column = " QLD" & First Char of Customer name column= (Present between)"A to F" Then assign name of executive as Reith,
else "other"
Kindly help with the same.
Thank you in advance!!
Solved! Go to Solution.
Hi @liberty20,
You can try to use the Unicode function to achieve your requirement:
formula =
VAR ATF =
GENERATESERIES ( UNICODE ( "A" ), UNICODE ( "F" ), 1 )
VAR GTK =
GENERATESERIES ( UNICODE ( "G" ), UNICODE ( "K" ), 1 )
RETURN
SWITCH (
Table[State],
"NSW",
IF (
UNICODE ( LEFT ( Table[Customer name], 1 ) ) IN ATF,
"John",
IF ( UNICODE ( LEFT ( Table[Customer name], 1 ) ) IN GTK, "Kevin", "Other" )
),
"QLD", IF ( UNICODE ( LEFT ( Table[Customer name], 1 ) ) IN ATF, "Reith", "Other" ),
"Other"
)
UNICODE function (DAX) - DAX | Microsoft Docs
Regards,
Xiaoxin Sheng
Hi @liberty20,
You can try to use the Unicode function to achieve your requirement:
formula =
VAR ATF =
GENERATESERIES ( UNICODE ( "A" ), UNICODE ( "F" ), 1 )
VAR GTK =
GENERATESERIES ( UNICODE ( "G" ), UNICODE ( "K" ), 1 )
RETURN
SWITCH (
Table[State],
"NSW",
IF (
UNICODE ( LEFT ( Table[Customer name], 1 ) ) IN ATF,
"John",
IF ( UNICODE ( LEFT ( Table[Customer name], 1 ) ) IN GTK, "Kevin", "Other" )
),
"QLD", IF ( UNICODE ( LEFT ( Table[Customer name], 1 ) ) IN ATF, "Reith", "Other" ),
"Other"
)
UNICODE function (DAX) - DAX | Microsoft Docs
Regards,
Xiaoxin Sheng
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 |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |