Forum Discussion
Passing a value to visual level filter through slicer
I have one data table called Stock Data, and it contains the week a stock was bought, the buyer, stock name, the cost, a boolean field for whether the stock has been sold, and if true, the week it was sold.
Right now I have a "Week" slicer, and two tables:
1. Purchased Stock -- the number of each stock purchased (and has yet to be sold)
2. Sold Stock -- the number of each stock sold
However, since the slicer is set to filter the page on "Week" and not "Week Sold", when I select Week 2, for example, the stocks that show up in the Sold Stock table were all purchased in Week 2. Ideally, I'd like to see the stocks that were sold on Week 2 in that table, rather than those that were purchased. I know it's not currently possible to set a visual-level filter to change depending on the slicer for a completely different field (e.g., where Week Sold = Week), but I was wondering if there was any way to code around this.
- if you make a week table of just week numbers (so you can use it as a pseudo date table) you can define a primary relationship between Te weektable[week] and stockdata[week] and a secondary (inactive) relationship between the weektable[week] and stockdqtq[soldweek]
You will then have to use measures for your calculations rather than just dragging the column name into the visual. And for the measure for sold use USERELATIONSHIP() function to specify the alternate relationship.
2 Replies
- Seward12533
Solution Sage
if you make a week table of just week numbers (so you can use it as a pseudo date table) you can define a primary relationship between Te weektable[week] and stockdata[week] and a secondary (inactive) relationship between the weektable[week] and stockdqtq[soldweek]
You will then have to use measures for your calculations rather than just dragging the column name into the visual. And for the measure for sold use USERELATIONSHIP() function to specify the alternate relationship.- christinamarieFrequent Visitor
This works really well, thank you!