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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Balta-expertise
Regular Visitor

Line Chart - 2 color in the same line

Hi Everyone,

 

I've an issue and I'm out of the solution

 

I've two data base :

- The first is for the real financial data ;

- The second is for the forecasted financial data ;

=> both base are identical (same column, same format of data item....)

=> There is always 12 months, no partial analyze

 

I want to create a line chart represent the the cumulative amount per month where :

- The real data is on line ;

- The reforcast is on dashed line ;

 

Baltaexpertise_0-1627542645977.png

 

For that, I've a cumulative measure :

- Cumulative amount : =CALCULATE(SUM('PL_cumulé'[Solde]),FILTER(ALLSELECTED('PL_cumulé'),'PL_cumulé'[Date] <=MAX('PL_cumulé'[Date]))

 

When I create a line chart, there is always a blank for the period beetwen real/reforecast. Does anyone know how to fill the blank to have one complete line. The first part is fill and the second on is dashed 

Baltaexpertise_1-1627543153794.png

 

Baltaexpertise_2-1627543307418.png

 

Thank you for your help guys !

 

 

 

1 ACCEPTED SOLUTION

Hi @Balta-expertise,

You can use measure expression to replace raw value fields and add if statement on these values to skip calculation on speed ranges After these steps, power bi will auto-hidden these blank parts.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

5 REPLIES 5
telesforo1969
Helper III
Helper III

real vs pronostico.JPG

 

1.- crea una columna con la fecha (Eje X)

2.- columna con los valores (Eje Y)

3.- columna con etiquetas Real y Pronóstico, (según corresponda a los valores)

4.- columna Categoría (leyenda), en mi ejemplo tengo dos tipos de combustibles, este es mi caso
5.- En tu tabla agrega una columna concatenando la columna 3 y 4 
 6.- la columna creada en el paso 5 la colocas en Leyenda.
7.- cambia los estilos de líneas

amitchandak
Super User
Super User

@Balta-expertise , I a single line you can not get dashed and normal line. So you need to two measure. In two measures you will not have a connection

 

You can have a single measure but the line color will not be different.

 

example: assuming you have given actual, using a common date table

- Cumulative amount : =CALCULATE(SUM('PL_cumulé'[Solde]) + Sum(Target[Target]) ,FILTER(ALLSELECTED('Date'),'Date'[Date] <=MAX('Date'[Date]))

Got it !

 

First, I calculate the cumulative amount

Second, I created 2 measures (as you sugget) with the filter on the data source base on the first calculate :

 

First :

CA_progressif =
CALCULATE(
SUM('CA_N_N-1_N-2'[Solde_économique]),
FILTER(
ALLSELECTED('CA_N_N-1_N-2'),
'CA_N_N-1_N-2'[Date] <=MAX('CA_N_N-1_N-2'[Date])))
 
Second : 
CA_progressif_n =
CALCULATE('CA_N_N-1_N-2'[CA_progressif],
'CA_N_N-1_N-2'[Année]="n")
 
and
 
CA_progressif_n-1 =
CALCULATE('CA_N_N-1_N-2'[CA_progressif],
'CA_N_N-1_N-2'[Année]="n-1")

hi @amitchandak ,

Thank you for your answer. What represent the "Target" on your SUM function ? When I try with 2 measures, they are superimposed. I try to add a filter on the calculate function but the lines doesn't stop and continued until the end of the year:

2021-07-29_15-45-28.jpg

 

Thank you very much fr your help. It's is more easy, I can share the PBIX File via dropbox ?

Jules

Hi @Balta-expertise,

You can use measure expression to replace raw value fields and add if statement on these values to skip calculation on speed ranges After these steps, power bi will auto-hidden these blank parts.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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