Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
(I do not read English, so I am posting a machine-translated text from Japanese.)
I am trying to change the color of a line chart midway through, and I have successfully done so.
However, as shown in the screenshot, the line breaks at the transition from "Actual" to "Forecast".
A gap appears in the middle of the chart.
How can I remove this gap and connect the line smoothly?
Is there a way to ensure continuity in the line chart?
---
Here is the original Japanese text before translation.▼
タイトル:
折れ線グラフの途中から途切れてしまう
本文:
※私は英語が読めないため、日本語を機械翻訳した文章を投稿しています。
折れ線グラフにて、途中から色を変えようとしています。
それには成功しました。
色変更の手順は以下のとおりです。
・折れ線グラフ用のデータとしてcsvを用意。
・csvでは Year Percentage Notes の3つの列を用意。
・折れ線グラフでは、「X軸にYear」「Y軸にPercentage」をセット。
・「Notes」を「凡例」にセット。
・視覚化 > ビジュアルの書式設定 > 行 から、「系列」で、Notesの各値ごとに色や線形をセット。
これで、Notesの「Actuarl → 青」「Forecast → オレンジ」「Target → Pink」を実現しました。
しかし、スクリーンショットの通り「ActualからForecastの変わり目」で、線が繋がりません。
途中で空白が出来てしまいます。
この空白を無くして、線をつなげたいと思っています。
この場合、線をつなげる方法はあるのでしょうか。
Solved! Go to Solution.
Hi @letItBept_01 ,
You line breaks because the information starts where the other stops meaning that since you do not have any data point for actual in 2025 the line ends in 2024 and does not connect to the other one.
There are a couple of options here:
Create the following measures:
Total Value = CALCULATE(SUM('Table'[Percentage]), REMOVEFILTERS('Table'[Notes]))
Actual = CALCULATE(SUM('Table'[Percentage]) , 'Table'[Notes] = "Actual")
Forecast = CALCULATE(SUM('Table'[Percentage]), 'Table'[Notes] = "Forecast")
Target = CALCULATE(SUM('Table'[Percentage]), 'Table'[Notes]= "Target")
Now add the measures to you line chart in the following order:
Then color you total value in a grey color
Second option:
Do not add the total measure and change the forecast and Target to the following code:
Forecast update = VAR _MinimunYear = MINX(
FILTER(
ALL('Table'),
'Table'[Notes] = "Forecast"
),
'Table'[Year]
)
RETURN
IF(
SELECTEDVALUE('Table'[Year]) = _MinimunYear - 1,
CALCULATE(
SUM('Table'[Percentage]),
'Table'[Year] = _MinimunYear - 1
),
CALCULATE(
SUM('Table'[Percentage]),
'Table'[Notes] = "Forecast"
)
)
Target Updated = VAR _MinimunYear = MINX(
FILTER(
ALL('Table'),
'Table'[Notes] = "Target"
),
'Table'[Year]
)
RETURN
IF(
SELECTEDVALUE('Table'[Year]) = _MinimunYear - 1,
CALCULATE(
SUM('Table'[Percentage]),
'Table'[Year] = _MinimunYear - 1
),
CALCULATE(
SUM('Table'[Percentage]),
'Table'[Notes] = "Target"
)
)
Now add the measures in the following order:
See PBIX File attach.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @letItBept_01 ,
You line breaks because the information starts where the other stops meaning that since you do not have any data point for actual in 2025 the line ends in 2024 and does not connect to the other one.
There are a couple of options here:
Create the following measures:
Total Value = CALCULATE(SUM('Table'[Percentage]), REMOVEFILTERS('Table'[Notes]))
Actual = CALCULATE(SUM('Table'[Percentage]) , 'Table'[Notes] = "Actual")
Forecast = CALCULATE(SUM('Table'[Percentage]), 'Table'[Notes] = "Forecast")
Target = CALCULATE(SUM('Table'[Percentage]), 'Table'[Notes]= "Target")
Now add the measures to you line chart in the following order:
Then color you total value in a grey color
Second option:
Do not add the total measure and change the forecast and Target to the following code:
Forecast update = VAR _MinimunYear = MINX(
FILTER(
ALL('Table'),
'Table'[Notes] = "Forecast"
),
'Table'[Year]
)
RETURN
IF(
SELECTEDVALUE('Table'[Year]) = _MinimunYear - 1,
CALCULATE(
SUM('Table'[Percentage]),
'Table'[Year] = _MinimunYear - 1
),
CALCULATE(
SUM('Table'[Percentage]),
'Table'[Notes] = "Forecast"
)
)
Target Updated = VAR _MinimunYear = MINX(
FILTER(
ALL('Table'),
'Table'[Notes] = "Target"
),
'Table'[Year]
)
RETURN
IF(
SELECTEDVALUE('Table'[Year]) = _MinimunYear - 1,
CALCULATE(
SUM('Table'[Percentage]),
'Table'[Year] = _MinimunYear - 1
),
CALCULATE(
SUM('Table'[Percentage]),
'Table'[Notes] = "Target"
)
)
Now add the measures in the following order:
See PBIX File attach.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThank you!
It looks like the verification will take some time, but I'll give it a try.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
126 | |
113 | |
71 | |
65 | |
46 |