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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply

To fix the color to the line chart based on the slicer selection

Hi Team,

Power bi Data Source

DateStockNameNameValue
7/19/2024RelienceEPS10.67
7/19/2024RelienceGPS11.36
7/19/2024RelienceRPS12.05
7/19/2024RelienceNPS12.74
7/19/2024RelienceBPS13.43
7/19/2024MedicoEPS10.67
7/19/2024MedicoGPS7.91
7/19/2024MedicoRPS5.15
7/19/2024MedicoNPS2.39
7/19/2024MedicoBPS13.43
7/19/2024BPOEPS24.47
7/19/2024BPOGPS35.51
7/19/2024BPORPS46.55
7/19/2024BPONPS57.59
7/19/2024BPOBPS68.63
7/18/2024RelienceEPS8.9
7/18/2024RelienceGPS11.36
7/18/2024RelienceRPS13.82
7/18/2024RelienceNPS16.28
7/18/2024RelienceBPS18.74
7/18/2024MedicoEPS21.2
7/18/2024MedicoGPS23.66
7/18/2024MedicoRPS26.12
7/18/2024MedicoNPS28.58
7/18/2024MedicoBPS31.04
7/18/2024BPOEPS33.5
7/18/2024BPOGPS35.96
7/18/2024BPORPS38.42
7/18/2024BPONPS40.88
7/18/2024BPOBPS43.34

 

 

i have a stock name as in the slicer

and in the line graph i have put
xaxis-Date
yaxis-Value
Legent-StockName


requirement

when we select first stock from the slicer then it should give marun colur in the line chart and when i select more than one stock then it sould give me grey colur to the second stock , basically user willl select only two stocks most of the times becuase he just need to do comparision between two stocks

and the same color should apply to table matrix it means in the column will give the same color as in the line chart
rows-Name
Columns-StockName
Values-RecentValue

RecentValue =
VAR SelectedTradeDate = SELECTEDVALUE(DASCaptured[Date])
VAR SelectedInstrument = SELECTEDVALUE(DASCaptured[StockName])
VAR SelectedName = SELECTEDVALUE(DASCaptured[Name])
VAR MaxDate =
CALCULATE(
MAX(DASCaptured[Date]),
FILTER(
ALL(DASCaptured),
DASCaptured[Date] <= SelectedTradeDate &&
DASCaptured[StockName] = SelectedInstrument &&
DASCaptured[Name] = SelectedName
)
)
RETURN
CALCULATE(
MAX(DASCaptured[CValue]),
FILTER(
ALL(DASCaptured),
DASCaptured[Date] = MaxDate &&
DASCaptured[StockName] = SelectedInstrument &&
DASCaptured[Name] = SelectedName
)
)



Thanks

2 REPLIES 2
amitchandak
Super User
Super User

@anshenterprice , As of now we can not control the color of line based on conditions. It can not change based on the measure.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak  is there any other solution ? becuase we have three visual in the page
1 TableMatrix and two line chart 
when we select two stocks from the slicer then it should give the same color for tablematrix and the other two line charts everytime 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.