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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Morten_K
Regular Visitor

Line chart- multiple lines and selections

Hi all,

 

I'm trying to setup a line chart, that has the following features:

  1. The number of lines is dependent on what I have selected in a table (matrix). I.e. either one of more lines.
  2. The possibility to select between different KPIs. I don't need to show multiple KPIs in the same line chart, but it should be possible for the user to select which KPI that should be shown in the line chart.

 

Has any of you tried this before?

 

Thank you in advance.

2 ACCEPTED SOLUTIONS

hi,

 

I actually found a solution to the case with the number of lines. I just added markets to the legend in the chart, and then made a slicer next to it, which is only linked to this specific line chart. That works quite well.

 

Regard the other problem: Dynamic KPI selection in the line chart.

 

I am working with three different KPIs on the page, and will like to be able to switch manually between these three KPIs in this line chart (only on at the time). I have seen something like this other places, but would like to get guidance on how to do this.

View solution in original post

Hi @Morten_K,



 

Regard the other problem: Dynamic KPI selection in the line chart.

 

I am working with three different KPIs on the page, and will like to be able to switch manually between these three KPIs in this line chart (only on at the time). I have seen something like this other places, but would like to get guidance on how to do this.


If I understand you correctly, one option is create separate measures to do the corresponding calculation for each KPI first(measure1, measure2, measure3), then use SWITCH function to create a new measure to return the corresponding measure for the selected KPI, and show this measure on the line chart in this scenario.

 

You may need to add a new table which has a column of KPI Type if you don't have yet. Then you can use this KPI Type column as a Slicer on the report.

KPI Type
KPI1
KPI2
KPI3


In addition, the formula below to create the dynamic measure is for your reference. Smiley Happy

Measure for Selected KPI =
SWITCH (
    FIRSTNONBLANK ( 'Table1'[KPI Type], 1 ),
    "KPI1", [measure1],
    "KPI2", [measure2],
    [measure3]
)

 

Regards

View solution in original post

4 REPLIES 4
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @Morten_K,

 

Without knowing your tables structures, it's hard to say if it is possible to, or how to achieve your expected result. So could you post your table structures with some sample data and your expected result against it, so that we can better assist on the issue? Smiley Happy

 

Regards

hi,

 

I actually found a solution to the case with the number of lines. I just added markets to the legend in the chart, and then made a slicer next to it, which is only linked to this specific line chart. That works quite well.

 

Regard the other problem: Dynamic KPI selection in the line chart.

 

I am working with three different KPIs on the page, and will like to be able to switch manually between these three KPIs in this line chart (only on at the time). I have seen something like this other places, but would like to get guidance on how to do this.

Hi @Morten_K,



 

Regard the other problem: Dynamic KPI selection in the line chart.

 

I am working with three different KPIs on the page, and will like to be able to switch manually between these three KPIs in this line chart (only on at the time). I have seen something like this other places, but would like to get guidance on how to do this.


If I understand you correctly, one option is create separate measures to do the corresponding calculation for each KPI first(measure1, measure2, measure3), then use SWITCH function to create a new measure to return the corresponding measure for the selected KPI, and show this measure on the line chart in this scenario.

 

You may need to add a new table which has a column of KPI Type if you don't have yet. Then you can use this KPI Type column as a Slicer on the report.

KPI Type
KPI1
KPI2
KPI3


In addition, the formula below to create the dynamic measure is for your reference. Smiley Happy

Measure for Selected KPI =
SWITCH (
    FIRSTNONBLANK ( 'Table1'[KPI Type], 1 ),
    "KPI1", [measure1],
    "KPI2", [measure2],
    [measure3]
)

 

Regards

fhill
Resident Rockstar
Resident Rockstar

See if this video helps.  The presentor creates a 'Measure' Table then uses If Contains to display / hide lines on a chart...

 

http://pragmaticworks.com/Training/Details/Advanced-DAX-Problem-Design-Solution

 

FORrest




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.