The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
---|---|
16 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |