cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rohit7005
Microsoft
Microsoft

Please Advise - I want Single Line for Actual and Predicted data and Multiple Icons in a LineChart

I need a Line chart as below that is filtered by Country->Customers->MachineType->MachineModel->Parts.

The Chart represents Consumed Material (In Tons) of Machines in Y-Axis and X-Axis is over time (Year-Months-Day).

My data is coming from a ML model that stores value for past 3 months and next 365 days.

1. How can I show the actual and predicted value in the same line with different colors? I can't use two lines to represent this.

2. How can I display multiple (around 100) icons ( Represented as Xs in below Picture) on the same line to represent another field value maintenance dates of Parts.

 

Rohit7005_0-1609971385095.jpeg

 

1 ACCEPTED SOLUTION
Eyelyn9
Community Support
Community Support

Hi @Rohit7005 ,

 

According to my understanding, you want to set two colors based on before and after Today,right?

I did it in two ways. Please take a look at the pbix file here.

 

1.Use the following formula to add a column settins as legend:

Legend =
IF ( [Date] >= TODAY (), "After", "Before" )

1.12.2.1.gif

 

2.Create a color measure, apply it to Data color

Measure =
IF ( MAX ( 'Table'[Date] ) >= TODAY (), "Red", "Green" )

Then create a column chart first, and switch it to line chart like this:

1.12.2.2.gif

 

In addition, to my knowledge, Power BI Desktop doesn't directly support Conditional Formatting feature in Line chart, but this is at idea/feedback level alone. May be , hopes Power Bi will implement this in nearby future.

 

If you also want this in power bi, let the power bi community to know this things and give your votes at power bi site's feedback -

https://ideas.powerbi.com/ideas/idea/?ideaid=59734f89-363d-41e8-be27-f123765dfd2f

 

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Eyelyn9
Community Support
Community Support

Hi @Rohit7005 ,

 

According to my understanding, you want to set two colors based on before and after Today,right?

I did it in two ways. Please take a look at the pbix file here.

 

1.Use the following formula to add a column settins as legend:

Legend =
IF ( [Date] >= TODAY (), "After", "Before" )

1.12.2.1.gif

 

2.Create a color measure, apply it to Data color

Measure =
IF ( MAX ( 'Table'[Date] ) >= TODAY (), "Red", "Green" )

Then create a column chart first, and switch it to line chart like this:

1.12.2.2.gif

 

In addition, to my knowledge, Power BI Desktop doesn't directly support Conditional Formatting feature in Line chart, but this is at idea/feedback level alone. May be , hopes Power Bi will implement this in nearby future.

 

If you also want this in power bi, let the power bi community to know this things and give your votes at power bi site's feedback -

https://ideas.powerbi.com/ideas/idea/?ideaid=59734f89-363d-41e8-be27-f123765dfd2f

 

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

littlemojopuppy
Super User I
Super User I

Hi @Rohit7005 

 

First question...try these measures.  I assume that you already have measures for actual and forecast...

Switch Between Measures =
IF(
	MAX([Date]) <= TODAY(),
	[Measure 1],
	[Measure 2]
)

Switch Between Colors =
IF(
	MAX([Date]) <= TODAY(),
	"Green",
	"Purple"
)

The second measure you'll want to plug into conditional formatting for the line chart.  Choose whichever colors you like or you can substitute hex codes for the colors.

 

I'm not sure what you mean for the second question...but if means what I think you're asking I don't think that's possible.  Maybe someone else can help with that part of it.

Hi @littlemojopuppy ,

 

Thanks for your reply, I did create the two measures for actual and forecast. Based on your input I created the 'Switch Between Measure'. But I don't find the conditional formatting options available to plug in the 'Switch Between Colors' Measure. Please check the picture below.

 

forum.JPG

 

Thanks in Advance!

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

April Update

Check it Out!

Click here to read more about the April 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

secondImage

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.