You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Power BI单数据集多折线图绘制求助:基于单列不同筛选条件

How to Plot Multiple Lines in Power BI with Shared Filters & Unique Column A Values

Hey there! I’ve run into this exact scenario countless times—wanting multiple lines in one chart that share most filters but differ on a single column. Let me break down the two best ways to solve this, starting with the most straightforward method.

This approach keeps your original dataset intact and lets you dynamically apply shared filters without extra data reshaping.

Step 1: Create a Measure for Each Column A Value

For every distinct value in Column A that you want a line for, create a dedicated measure using CALCULATE. This function will respect your shared filters while adding the unique Column A filter for each line.

For example, if your table is named SalesData, your numeric column is Revenue, and Column A has values "1" and "2", your measures would look like:

Revenue for A=1 = CALCULATE(SUM(SalesData[Revenue]), SalesData[Column A] = "1")
Revenue for A=2 = CALCULATE(SUM(SalesData[Revenue]), SalesData[Column A] = "2")

The CALCULATE function automatically inherits any existing filters (your 3 shared ones) and adds the specific Column A filter on top.

Step 2: Build Your Line Chart

  • Drag your shared axis (e.g., Date) to the X-axis of a line chart.
  • Drag each of your new measures to the Values section of the Y-axis.
  • Apply your 3 shared filters (via slicers, page filters, or report filters)—all lines will automatically use these filters while sticking to their unique Column A value.

Method 2: Reshape Your Data (Good for Fixed Column A Values)

If you prefer working with a reshaped dataset instead of measures, you can use Power Query to pivot your data so each Column A value becomes a separate column.

Step 1: Pivot in Power Query

  • Load your dataset into Power Query Editor.
  • Select Column A and your numeric column (e.g., Revenue).
  • Go to Transform > Pivot Column.
  • Choose your numeric column as the "Values Column" and leave "Advanced options" set to "Sum" (or your preferred aggregation).
  • This will create a new column for each value in Column A (e.g., Revenue_1, Revenue_2).

Step 2: Build the Chart

  • Use the pivoted columns as your Y-axis values, add your shared X-axis, and apply your 3 filters—same as the measure method.

Pro Tip for Many Column A Values

If Column A has dozens of distinct values, manually creating measures is tedious. Instead, use Field Parameters:

  1. Create a field parameter that includes all distinct values from Column A.
  2. Write a single dynamic measure that uses SELECTEDVALUE to pick the right Column A value based on the parameter.
  3. Add the parameter to your chart's legend to toggle lines on/off dynamically.

内容的提问来源于stack exchange,提问作者Juan Carlos Joaquin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:16:48