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
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

6 REPLIES 6
telesforo1969
Resolver I
Resolver I

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

This helped a lot, though an adjustment. Thank you!

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]))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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
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! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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