Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
i need assistance with creating a dynmic line chart in power bi. I have a dataset with the following columns: date, material code and quantity. My goal is to create a line chart that updated based on the selected material code using a slicer.
here are the specific requirements:
- i want to create a slicer for the material code column
- when i select a single material code form the slicer, the line chart should displaythe total quantity for the material code over time
- when i select multiple material codes from the slicer, the line chart should show multiple lines, each representing the total quantity for each selected material code over time
Additionally, the line chart should display a line that represents the total quantity of all selected material codes combined over time
Example:
- If I select Material Code "A" and "B" from the slicer, the line chart should display:
- A line showing the total quantity for Material Code "A" over time.
- A line showing the total quantity for Material Code "B" over time.
- An additional line showing the combined total quantity for both Material Code "A" and "B" over time.
->Dataset Information:
The dataset contains more than 100 material codes.
What I have tried:
I have created the following DAX measures:
-DAX
Total_quantity_dynamic =
SUM('Sheet'[accept_quantity])
Combined_total_quantity_selected =
CALCULATE(
SUM('Sheet'[accept_quantity]),
ALLSELECTED('Sheet')
)
Using these measures, I can create a slicer for Material Code and a line chart. However, I am having trouble achieving the desired behavior where the line chart shows separate lines for each selected material code along with an additional combined total line.
What I Need Help With:
-How can I dynamically display separate lines for each selected material code using DAX or any other method in Power BI?
-How can I add a line that represents the combined total quantity of the selected material codes over time?
Any assistance or guidance on how to achieve this in Power BI would be greatly appreciated.
Thank you!
Hi @Swetha_24
Could you please provide me with some sample data and the results based on sample data? That would be very helpful. How to provide sample data in the Power BI Forum - Microsoft Fabric Community Or show it as a screenshot or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account. Thank you for your time and efforts in advance.
Best Regards,
Yulia Xu
Hi @Yulia Xu
Here is the sample data for reference
Currently, my line chart only shows the total quantity line, but I want to display separate lines for each selected material code along with the total quantity line for the selected material codes.
Best Regards,
Swetha
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 57 | |
| 44 | |
| 41 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 183 | |
| 114 | |
| 93 | |
| 61 | |
| 45 |