Home > Mobile >  How to plot a line graph filtering by two columns?
How to plot a line graph filtering by two columns?

Time:01-19

this is my first time asking a question here so I'll try my best.

CONTEXT/DATA: I've a data set (example of it below) with daily data of different stores as well as their sales, forecast, region and store profile. Now I want to make a line plot showing the sales and forecast for each region/profile so it would be something like this for example 'South I-Big', 'South I-Medium' and 'South I-Small'.

Altogether I have 22 different regions and 3 store levels (small, medium and big).

day store region profile sales forecast
2023-01-02 101 South I BIG 12348.02 11987.00
2023-01-03 101 South I BIG 13452.39 12546.00
2023-01-04 101 South I BIG 14567.54 14385.00
2023-01-05 101 South I BIG 17624.32 16292.00
2023-01-06 101 South I BIG 18345.87 18109.00
2023-01-07 101 South I BIG 20987.10 19786.00
2023-01-02 102 South I SMALL 8456.98 8260.00
2023-01-03 102 South I SMALL 9021.45 9110.00
2023-01-04 102 South I SMALL 9237.89 9100.00
2023-01-05 102 South I SMALL 9785.21 9277.00
2023-01-06 102 South I SMALL 10325.33 9897.00
2023-01-07 102 South I SMALL 10899.67 10345.00
2023-01-02 103 South I MEDIUM 9865.32 9765.00
2023-01-03 103 South I MEDIUM 10101.72 10010.00
2023-01-04 103 South I MEDIUM 10672.43 10115.00
2023-01-05 103 South I MEDIUM 11347.93 10872.00
2023-01-06 103 South I MEDIUM 11785.20 11195.00
2023-01-07 103 South I MEDIUM 12321.78 11942.00
... ... ... ... ... ...

QUESTION: Is there a way to make a line plot "grouping" by region and then "grouping by" store profile while showing sales and forecast for each "combination" of it so I would have three separeted graphs for each region?!

I've tried to using 'for loop', 'dropdown menu' and other things that I found for similar questions here on Stack but since most of them were regarding just one grouping I couldn't work my way around it.

Current output: One graph for region showing the sales and forecast for all three profiles. enter image description here

  • Related