Forum Discussion
Adding 2nd line to line chart based on same table (but different filter context)
Hi,
I have a requirement to add a (selectable) comparison line to an event sales timeline chart below:
The page this visual is on has a drop-down slicer that chooses the main event (as shown above) and also has many other visuals showing data about that event. There are 2 things I need help with:
- How to provide a method for the user to select the comparison event (just for this chart)
- How to add the sales data to the above chart for the comparison event
I've been looking into both things:
1.
a. I tried adding another slicer with the event list column to the page but this obviously followed the main slicer and interacted with the other visuals. I tried to decouple it with Edit interactions but this was very laborious because of the need to decouple it from every other visual on the page (there's 20 or more). And even then the result was that both slicers where affecting the filter context so no data was being shown on the visuals.
b. I have considered creating a separate (hidden) page where there would be a slicer to select the comparison event, then use bookmarks/page navagation and buttons to switch between the main page or set the comparison event page.
2.
a. Not really sure how to get two sets of filtered data from the same table to show on the same chart. I'm wondering if there a way using measures and SELECTEDVALUE, ISFILTERED, REMOVEFILTERS, ALLEXCEPT etc
b. But not sure how I access the selected value in the comparison slicer. I wondered about creating a duplicate calculated column of the event name (eg called "CompEventName") such that the main event would be what was selected in the "EventName" column and the comparison event would be what was selected in the "CompEventName" column.
Any help on this would be much appreciated.
mbowler check these videos on my channel and tweak the solution as per your needs.
Compare selected customer sales with other customers - various methods (Part 1) (youtube.com)
Compare selected client sales with other TOP N clients - Part 2 (youtube.com)
2 Replies
- parry2k
Super User
mbowler check these videos on my channel and tweak the solution as per your needs.
Compare selected customer sales with other customers - various methods (Part 1) (youtube.com)
Compare selected client sales with other TOP N clients - Part 2 (youtube.com)
- mbowler
Helper I
Fantastic parry2k, just what I needed! This community is great.
Just to help those who might read this later, here's what I did to solve my problem:
- Created a new (disconnected) table with just the list of the Event names: CompEventsList = VALUES(AllPerformances[EventName])
- This allowed me to have a second slicer on the same page with the same set of Event names but completely independent of the slicer that is controlling the rest of the visuals on the page.
- Created a new measure that uses the same measure as in the line chart for the main event but changing the conext to the second table using TREATAS:
- Comparison Event Running Total = CALCULATE( [Main Event Running Total], TREATAS( VALUES( CompEventsList[EventName] ), AllPerformances[EventName] ))
- Add the measure above to my line chart
- Created a new (disconnected) table with just the list of the Event names: CompEventsList = VALUES(AllPerformances[EventName])