cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PuneetSoni
Frequent Visitor

SWITCH

Hello all,

I have a table with columns values as current calls (aNCO), budgeted calls(bNCO), last year calls(LyNCO), current AHT (aAHT), budgeted AHT(bAHT), Last year AHT(LyAHT). i need to use switch function so that if i select NCO it will display data for all calls, if i select AHT, it will display all AHT. 

1 ACCEPTED SOLUTION

SWITCH itself cannot change the measures in the chart, it's basically a multiple IF

 

you can use a set of measures like below - in this case the measure will stay the same and just show different value:

Current =
SWITCH (
    SELECTEDVALUE ( Slicer[NCO-AHT] ),
    "NCO", SUM ( Table[aNCO] ),
    "AHT", SUM ( Table[aAHT] ),
    BLANK ()
)
Budget=
SWITCH (
    SELECTEDVALUE ( Slicer[NCO-AHT] ),
    "NCO", SUM ( Table[bNCO] ),
    "AHT", SUM ( Table[bAHT] ),
    BLANK ()
)

if you want to keep the setup as is then you may try with bookmarks

https://docs.microsoft.com/en-us/power-bi/desktop-bookmarks

I'm not sure whether they will remember changing the measures, if not you may create overlapping charts, and set actions to hide the non relevant one. So e.g. if you select NCO in the slicer bookmark will hide all non-NCO charts and make visible only the one with NCO set of measures

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Proud to be a Super User!

View solution in original post

3 REPLIES 3
PuneetSoni
Frequent Visitor

Thanks Stachu. I am new to power bi. Yes i wanted to show them seperately(and add more later on). below will clear this more. I have created slicer called Measure which is a seperate table (KPI) and is not lined. I wanted to select NCO and it will show all NOC (aNOC,bNCO,LeNCO,LyNCO) from workforceKPI_YOY table. Capture.PNG

 

SWITCH itself cannot change the measures in the chart, it's basically a multiple IF

 

you can use a set of measures like below - in this case the measure will stay the same and just show different value:

Current =
SWITCH (
    SELECTEDVALUE ( Slicer[NCO-AHT] ),
    "NCO", SUM ( Table[aNCO] ),
    "AHT", SUM ( Table[aAHT] ),
    BLANK ()
)
Budget=
SWITCH (
    SELECTEDVALUE ( Slicer[NCO-AHT] ),
    "NCO", SUM ( Table[bNCO] ),
    "AHT", SUM ( Table[bAHT] ),
    BLANK ()
)

if you want to keep the setup as is then you may try with bookmarks

https://docs.microsoft.com/en-us/power-bi/desktop-bookmarks

I'm not sure whether they will remember changing the measures, if not you may create overlapping charts, and set actions to hide the non relevant one. So e.g. if you select NCO in the slicer bookmark will hide all non-NCO charts and make visible only the one with NCO set of measures

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Proud to be a Super User!

Stachu
Community Champion
Community Champion

I assume you want to show all 3 measures on the chart, not merged as a single one? If they would be merged, what would be the aggregation method?

you could try creating  3 measures in this manner:

Current =
SWITCH (
    SELECTEDVALUE ( Slicer[NCO-AHT] ),
    "NCO", SUM ( Table[aNCO] ),
    "AHT", SUM ( Table[aAHT] ),
    BLANK ()
)

or if you want to aggregate by sum

 

 

Current =
SWITCH (
    SELECTEDVALUE ( Slicer[NCO-AHT] ),
    "NCO", SUM ( Table[aNCO] ) + SUM ( Table[bNCO] ) + SUM ( Table[lyNCO] ),
    "AHT", SUM ( Table[aAHT] ) + SUM ( Table[bAHT] ) + SUM ( Table[lyAHT] ),
    BLANK ()
)
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Proud to be a Super User!

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors