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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

DAX Measure help

Hi!
 
I am trying to migrate a calculation from Qlik to Power BI. But I am having difficulties to make it work 100%. 
Would love to have some help here regarding this..
 
So what I want to do in words:
[No of Calls] WHERE Exclude [Wrap Up Group] = "BO Action" & "BO Support" AND Exclude [Workgroup] = *GDPR*
+
[No of Emails] WHERE Exclude [Wrap Up Group] = "BO Action" & "BO Support" AND Exclude [Workgroup] = *GDPR*
+
IF(
    Agent Type = "Live Agent",
        [No of Chats Answered LA],
           ELSE IF(
                Agent Type] = "VA Agent",
                    [No of Chats Answered VA],
                       ELSE [No of Chats Answered]
 /
[No of Orders]
 
 
I tried to create this as a DAX code without success, see below.

Contact per Order % =
(CALCULATE(
    [No of Emails]+[No of Calls], Filter( dim_wrapupgroup , not( dim_wrapupgroup[Wrap Up Group] in {"BO Action", "BO Support"})),
                    Filter( view_interaction, SEARCH("*GDPR*",view_interaction[Workgroup],1,0) = 0 )
    )
+
IF(
    MAX(dim_agenttype[Agent Type]) = "Live Agent",
        [No of Chats Answered LA],
            IF(
                MAX(dim_agenttype[Agent Type]) = "VA Agent",
                    [No of Chats Answered VA],
                        [No of Chats Answered]
            )
    )
)
/
[No of Orders]
 
I think it's the last part with the IF-statements that messes it up. Guessing maybe a SWITCH somehow will fix it?
Would love to get some help here!
 
BR Fredrik
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

 

Thanks for your response!

 

There are some things in this calculation that are not correct from what I asked about from the start.

- Should be divided by No of Orders in the end

- Should exclude all rows that has Workgroup = *GDPR* 

 

I did however solve it afterwards it seems!

 

VAR dCall =
CALCULATE(
    [No of Calls],
        Filter( dim_wrapupgroup, NOT( dim_wrapupgroup[Wrap Up Group] IN {"BO Action",
                                                                        "BO Support",
                                                                        "STORE",
                                                                        "H&M CLUB"})),
        Filter( view_interaction, SEARCH("*GDPR*",view_interaction[Workgroup],1,0) = 0 )
)

VAR dEmail =
CALCULATE(
    [No of Emails],
        Filter( dim_wrapupgroup, NOT( dim_wrapupgroup[Wrap Up Group] IN {"BO Action",
                                                                        "BO Support",
                                                                        "STORE",
                                                                        "H&M CLUB"})),
        Filter( view_interaction, SEARCH("*GDPR*",view_interaction[Workgroup],1,0) = 0 )
)

VAR dChat =
SWITCH(TRUE(),
MAX(dim_agenttype[Agent Type]) = "Live Agent", [No of Chats Answered LA],
MAX(dim_agenttype[Agent Type]) = "VA Agent", [No of Chats Answered VA],
[No of Chats Answered]
)

VAR dOrder =
[No of Orders]

RETURN
IFERROR((dCall+dEmail+dChat) / dOrder,
    BLANK()
)

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1671509573446.png

 

Here are the steps you can follow:

1. Create measure.

Contact per Order % =
var _sum1=
SUMX(FILTER(ALL(dim_wrapupgroup),
NOT('dim_wrapupgroup'[Wrap Up Group]) in {"BO Action", "BO Support"}
&&
CONTAINSSTRING('dim_wrapupgroup'[Workgroup],"GDPR")=TRUE())
,[No of Calls]+[No of Emails])
var _sumif=
IF(
    MAX('dim_wrapupgroup'[Agent Type]) = "Live Agent",
        MAX('dim_wrapupgroup'[No of Chats Answered LA]),
            IF(
                MAX('dim_wrapupgroup'[Agent Type]) = "VA Agent",
                    MAX('dim_wrapupgroup'[No of Chats Answered VA]),
                        MAX('dim_wrapupgroup'[No of Chats Answered])
            ))
return
_sum1+_sumif

2. Result:

vyangliumsft_1-1671509573447.png

 

Best Regards,

Liu Yang

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,

 

Thanks for your response!

 

There are some things in this calculation that are not correct from what I asked about from the start.

- Should be divided by No of Orders in the end

- Should exclude all rows that has Workgroup = *GDPR* 

 

I did however solve it afterwards it seems!

 

VAR dCall =
CALCULATE(
    [No of Calls],
        Filter( dim_wrapupgroup, NOT( dim_wrapupgroup[Wrap Up Group] IN {"BO Action",
                                                                        "BO Support",
                                                                        "STORE",
                                                                        "H&M CLUB"})),
        Filter( view_interaction, SEARCH("*GDPR*",view_interaction[Workgroup],1,0) = 0 )
)

VAR dEmail =
CALCULATE(
    [No of Emails],
        Filter( dim_wrapupgroup, NOT( dim_wrapupgroup[Wrap Up Group] IN {"BO Action",
                                                                        "BO Support",
                                                                        "STORE",
                                                                        "H&M CLUB"})),
        Filter( view_interaction, SEARCH("*GDPR*",view_interaction[Workgroup],1,0) = 0 )
)

VAR dChat =
SWITCH(TRUE(),
MAX(dim_agenttype[Agent Type]) = "Live Agent", [No of Chats Answered LA],
MAX(dim_agenttype[Agent Type]) = "VA Agent", [No of Chats Answered VA],
[No of Chats Answered]
)

VAR dOrder =
[No of Orders]

RETURN
IFERROR((dCall+dEmail+dChat) / dOrder,
    BLANK()
)

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.