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
jayalmendarez
New Member

User Slicer to toggle showing a line chart with legend categories, and without legend as total

Hi there, 

I've got a data set and want to use a slicer to as toggle to update a line chart. My slicer entitled "View" has two options Per Area and Per Asset. What I want is whenever I select "Per Asset" for my line chart to just plot the values against the dates I have. See image below:

jayalmendarez_0-1635874028205.png

 

Next when I selet "Per Area", I'd like my chart to dynamically change by plotting the values against dates per category (legen). See image below:

jayalmendarez_1-1635874104818.png

I'm not sure if there's a way to do this. I'm thinking I need to create a special measure to use within line chart values input that changes with the slicer. The slicer is just a manual table I created with two values as mentioned above and only one can be selected at a time.

 


Help is appreciated!!

 

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @jayalmendarez 

 

As @PaulDBrown @AlexisOlson  said above, bookmarks and buttons are a good choice.

Here's a blog about how bookmarks and buttons can help:

Bookmarks and Buttons: Making Power BI Charts Even More Interactive

 

Alternatively, we can get similar results without using bookmarks and buttons.


This is actually a case of dynamic axis

What you need to do is to aggregate the different KPIs into a new calculation table and then use the TREATAS function to filter the table to get the results.

 

Sample:

vangzhengmsft_0-1636083095635.png

 

_KPI = 
VAR table1=SELECTCOLUMNS(
    ADDCOLUMNS(VALUES('Table'[Asset]),"KPI","Asset"),
    "KPI",[KPI],"category",[Asset])
VAR table2=SELECTCOLUMNS(
    ADDCOLUMNS(VALUES('Table'[Area]),"KPI","Area"),
    "KPI",[KPI],"category",[Area])
RETURN UNION(table1,table2)
value = 
    SWITCH(TRUE(),
        SELECTEDVALUE('_KPI'[KPI])="Asset",CALCULATE(_KPI[_Sales],TREATAS(VALUES('_KPI'[category]),'Table'[Asset])),
        SELECTEDVALUE('_KPI'[KPI])="Area",CALCULATE(_KPI[_Sales],TREATAS(VALUES('_KPI'[category]),'Table'[Area]))
    )

 

I've already done this in the thread below using the bar chart as a case study, Modifying my formula can be applied to a line graph, for ease of understanding I've implemented it and posted it here, hope it helps to understand

 

refer:

help with dax calculation on which date column to use

 

Please refer to the attachment below for details. Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-angzheng-msft
Community Support
Community Support

Hi, @jayalmendarez 

 

As @PaulDBrown @AlexisOlson  said above, bookmarks and buttons are a good choice.

Here's a blog about how bookmarks and buttons can help:

Bookmarks and Buttons: Making Power BI Charts Even More Interactive

 

Alternatively, we can get similar results without using bookmarks and buttons.


This is actually a case of dynamic axis

What you need to do is to aggregate the different KPIs into a new calculation table and then use the TREATAS function to filter the table to get the results.

 

Sample:

vangzhengmsft_0-1636083095635.png

 

_KPI = 
VAR table1=SELECTCOLUMNS(
    ADDCOLUMNS(VALUES('Table'[Asset]),"KPI","Asset"),
    "KPI",[KPI],"category",[Asset])
VAR table2=SELECTCOLUMNS(
    ADDCOLUMNS(VALUES('Table'[Area]),"KPI","Area"),
    "KPI",[KPI],"category",[Area])
RETURN UNION(table1,table2)
value = 
    SWITCH(TRUE(),
        SELECTEDVALUE('_KPI'[KPI])="Asset",CALCULATE(_KPI[_Sales],TREATAS(VALUES('_KPI'[category]),'Table'[Asset])),
        SELECTEDVALUE('_KPI'[KPI])="Area",CALCULATE(_KPI[_Sales],TREATAS(VALUES('_KPI'[category]),'Table'[Area]))
    )

 

I've already done this in the thread below using the bar chart as a case study, Modifying my formula can be applied to a line graph, for ease of understanding I've implemented it and posted it here, hope it helps to understand

 

refer:

help with dax calculation on which date column to use

 

Please refer to the attachment below for details. Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PaulDBrown
Community Champion
Community Champion

The best option is probably to use bookmarks and buttons to toggle between visuals





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






AlexisOlson
Super User
Super User

It might be easier to use buttons and bookmarks for this rather than slicers and measures.

jayalmendarez
New Member

@amitchandak @AlexisOlson @Greg_Deckler worth a shot lol 

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.

Top Solution Authors
Top Kudoed Authors