Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi! Need to add a condition to my Switch measure "Total Dynamic Calls"
I want it to output "0" for SUM of [Total Calls] from the 'Combined Call Logs 5/17' table if the value "Field" from the UpdatedProd521 [Enrollment Type] table is selected in a slicer.
Otherwise, it should output SUM Total Calls if the value "Call Center" is selected. Thanks in advance!
Here is the current Switch measure:
Solved! Go to Solution.
Hi @jabueg,
This can be achieved by using the SELECTEDVALUE() function to determine which value is currently selected in the slicer. The measure below checks for a specific selection and adjusts the output accordingly:
Total Calls Dynamic =
VAR IsFieldSelected =
SELECTEDVALUE(UpdatedProd521[Enrollment Type]) = "Field"
RETURN
IF (
IsFieldSelected,
0,
SWITCH(
TRUE(),
// Case 1: Single Advisor AND Single Date selected
HASONEVALUE(UpdatedProd521[Advisor]) &&
HASONEVALUE(UpdatedProd521[Date]),
CALCULATE(
SUM('Combined Call Logs 5/17'[CALLS]),
USERELATIONSHIP(UpdatedProd521[Advisor], 'Combined Call Logs 5/17'[ADVISOR]),
FILTER(
'Combined Call Logs 5/17',
'Combined Call Logs 5/17'[DATE] = VALUES(UpdatedProd521[Date])
)
),
// Case 2: Only Advisor is selected
HASONEVALUE(UpdatedProd521[Advisor]),
CALCULATE(
SUM('Combined Call Logs 5/17'[CALLS]),
USERELATIONSHIP(UpdatedProd521[Advisor], 'Combined Call Logs 5/17'[ADVISOR])
),
// Case 3: Only Date is selected
HASONEVALUE(UpdatedProd521[Date]),
CALCULATE(
SUM('Combined Call Logs 5/17'[CALLS]),
USERELATIONSHIP('Combined Call Logs 5/17'[DATE], UpdatedProd521[Date])
),
// Default: sum all calls if no or multiple selections
SUM('Combined Call Logs 5/17'[CALLS])
)
)
If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,
Samson
Hi @jabueg,
This can be achieved by using the SELECTEDVALUE() function to determine which value is currently selected in the slicer. The measure below checks for a specific selection and adjusts the output accordingly:
Total Calls Dynamic =
VAR IsFieldSelected =
SELECTEDVALUE(UpdatedProd521[Enrollment Type]) = "Field"
RETURN
IF (
IsFieldSelected,
0,
SWITCH(
TRUE(),
// Case 1: Single Advisor AND Single Date selected
HASONEVALUE(UpdatedProd521[Advisor]) &&
HASONEVALUE(UpdatedProd521[Date]),
CALCULATE(
SUM('Combined Call Logs 5/17'[CALLS]),
USERELATIONSHIP(UpdatedProd521[Advisor], 'Combined Call Logs 5/17'[ADVISOR]),
FILTER(
'Combined Call Logs 5/17',
'Combined Call Logs 5/17'[DATE] = VALUES(UpdatedProd521[Date])
)
),
// Case 2: Only Advisor is selected
HASONEVALUE(UpdatedProd521[Advisor]),
CALCULATE(
SUM('Combined Call Logs 5/17'[CALLS]),
USERELATIONSHIP(UpdatedProd521[Advisor], 'Combined Call Logs 5/17'[ADVISOR])
),
// Case 3: Only Date is selected
HASONEVALUE(UpdatedProd521[Date]),
CALCULATE(
SUM('Combined Call Logs 5/17'[CALLS]),
USERELATIONSHIP('Combined Call Logs 5/17'[DATE], UpdatedProd521[Date])
),
// Default: sum all calls if no or multiple selections
SUM('Combined Call Logs 5/17'[CALLS])
)
)
If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,
Samson
Kudo 👌
User | Count |
---|---|
15 | |
13 | |
12 | |
10 | |
10 |
User | Count |
---|---|
19 | |
15 | |
14 | |
11 | |
10 |