Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Rohit7005
Employee
Employee

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
v-eqin-msft
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
v-eqin-msft
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.

littlemojopuppy
Community Champion
Community Champion

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.