March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello everyone,
Is it possible to create a single line chart equal to the number of items selected in a slicer?
Sample scenario is I have a product slicer where users can select more than 1 products.
Goal is to create a single line chart with multiple lines plotted equal to the number of products selected on the slicer.
X-axis will be dates, while y-axis would be an aggregate value of sales.
So if there are 4 products selected, there should be 4 lines on the line chart.
Kindly advise an approach on how to do this quickly. Right now, I am trying to achieve this through Python visual but having a hard time doing so. Any feedback will be much appreciated, thank you.
Hey @iamriz ,
this then will become more complex 😉
You have to adapt the solution that is described here to your needs: Show previous 6 months of data from single slicer selection - SQLBI
Hopefully, this provides you with an idea on how you can tackle your challenge.
Regards,
Tom
Hey @iamriz ,
not sure if I understand your requirment correctly, but this can be achieved using the Power BI line chart, simple drag the column that feeds the slicer also to the legend bucket of the line chart:
Not sure why you want to do this with python.
Hopefully, this provides an idea of how to tackle your challenge.
Regards,
Tom
Hi @TomMartens , thanks for your response. Very much appreciated. Indeed, your suggestion is correct. However, I lacked a detail to the scenario I mentioned. Basically, the x-axis values are just fixed values (not really the date as I originally mentioned in my post). This fixed values (0 to 6) represents the dynamic period as to which the aggregate of sales would be computed per Product.
Chart would look something like this:
Y-axis (sales)
10
9
...
2
1
0 1 2 3 4 5 6 = X-axis (fixed values)
If user inputs date = 5/8/2022 on a date slicer;
If x=6, the measure will return the sales 1 week ago from the date inputted (period of 5/2 to 5/8/2022);
If x=5, the measure will return the sales 2 weeks ago from the date inputted (period of 4/25 to 5/1/2022);
and so on, up until 6 weeks ago of weekly sales.
If I select a single product from the Product slicer, the measure will correctly be plotted in one line on the line chart above. However, if more than one is selected on the product slicer, the line chart will just show me one flat line on the 0 y-axis for some reason I don't know yet.
Hi @iamriz ,
According to your description, I think it relates to the formula of the Values in your line chart. You can try to change the line chart to a table visual to see if it can get the correct result when you select two products. Or you can provide more detailed sample data for further help.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
120 | |
77 | |
58 | |
52 | |
46 |
User | Count |
---|---|
171 | |
117 | |
63 | |
57 | |
51 |