Forum Discussion
Line chart - want to NOT CONNECT data series, using legend
Hi!
Problem with line chart, with only 1 data series (Cena), but, in legend, it's splited into different weeks'days , to get another colour for saturday and sanday - as below.
Unfortunatelly, Power Bi treats it as 7 different data series, and, when ones is ending (like red sundey), it automatically joints the last point, with the first point of next series (sundays- to sandays, saturdays to saturdays, mondays to tueasdays, tuesdays to wednesdays etc..) . In effect, i get strange curves , unreasonable for the users of report.
X axis must be continuosly (dates and hours).
How can I fix it?
Or any workaround to finally get line chart with different colours for different days?
2 Replies
- rajendraongole1
Super User
Hi Alexandreau -create a calculated column that assigns a label to each row based on whether the date falls on a weekday, Saturday, or Sunday.
DayType =
SWITCH(
WEEKDAY([Date], 2),
6, "Saturday",
7, "Sunday",
"Weekday"
)you can add Conditional Formatting for the Line Chart
Power BI supports conditional formatting for line colors. You can configure the line color to vary based on the "DayType" column.
In the Line chart visual, select the Line color option in the Format pane.
Set a rule-based conditional format:
Assign one color for "Weekday."
Assign another color for "Saturday."
Assign a third color for "Sunday."
This ensures that the line stays continuous and colors shift as desired.If Power BI still causes issues with disconnected lines:
Add Null Values for Missing Data Points:
Ensure there are null values (or zeros) for all days where the "Cena" value does not exist, forcing Power BI to stop connecting the line between separate series.- AlexandreauFrequent Visitor
I cannot see the option conditional formatting - it should be in this place:
My chart is a line chart, with only 1 data series.
BTW , i tried also use an etiquette , but it didn't work correctly - the etiquette was showing only 1 value (czwartek - in Polish thuesday) for each day. It looked like there is no neccessary relation. But in fact, the relation is, and works, what I can prove when I use the same data, and another visualsation - then the week day works correctly.
The reason is, I cannot set "Don't sum" , and it automatically takes some kind of calculation (in this case - Pierwszy - Polish - First)
While I change line chart into a table, there is possibility to change the setting "Don't Sum", and then it works ok.
Finally, I would love if there is a possibility to use different colours, not the etiquets - colours are more straightforward for the report'users.