Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

Optimizing DAX

Hi All,

 

I've created the below calculated column and its giving the correct result but somehow my performance is getting impacted as number of records are in 100s Millions,

 

Is there any better approach to follow here?

 

Calculation used:

Himanshu_1306_0-1696483682382.png

 

Regards

1 ACCEPTED SOLUTION

@Anonymous , I have made some changes in the DAX. Use this instead
EBU vs CBU =
var _v1 = VW_F_ACV[SALES_SEGMENT]
var _v2 = VW_F_ACV[ROLE] = ""
RETURN
    Switch(true(),
    _v2,
    Switch(
        true(),
        (_v1 = "Strategic" || _v1 = "Enterprise" || _v1 = "Large Corporate"),
        "EBU",
        (_v1 = "Mid Market"|| _v1 = "Commercial" || _v1 = "Undefined"),
        "CBU",
        VW_F_ACV[ROLE]),
    VW_F_ACV[ROLE]
    )
 
Thank You.

View solution in original post

3 REPLIES 3
ChiragGarg2512
Solution Sage
Solution Sage

@Anonymous , Use switch statement in DAX measure,

EBU vs CBU = 
var _v1 = VW_F_ACV[SALES_SEGMENT]
var _v2 = VW_F_ACV[ROLE] = ""
RETURN
    Switch(true(), 
    _v2, 
    Switch(
        true(), 
        OR(OR(_v1 = "Strategic", _v1 = "Enterprise"), _v1 = "Large Corporate"),
        "EBU", 
        OR(OR(_v1 = "Mid Market", _v1 = "Commercial"), _v1 = "Undefined"), 
        "CBU", 
        _v2),
    _v2
    )

 What is needed is to club the scenarios, for example in all of the condition the Role is "" so apply conditons on sales_segment and after that if there are conditions remaining return role itself.

 

Thank You.

Anonymous
Not applicable

Getting the below error while trying to use it

FYI : Both columns (Role and Sales Segment) have same data type.

 

Himanshu_1306_0-1696495771592.png

 

@Anonymous , I have made some changes in the DAX. Use this instead
EBU vs CBU =
var _v1 = VW_F_ACV[SALES_SEGMENT]
var _v2 = VW_F_ACV[ROLE] = ""
RETURN
    Switch(true(),
    _v2,
    Switch(
        true(),
        (_v1 = "Strategic" || _v1 = "Enterprise" || _v1 = "Large Corporate"),
        "EBU",
        (_v1 = "Mid Market"|| _v1 = "Commercial" || _v1 = "Undefined"),
        "CBU",
        VW_F_ACV[ROLE]),
    VW_F_ACV[ROLE]
    )
 
Thank You.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.