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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
nn92
Frequent Visitor

plot multiple lines with different data filters on one graph

Hi,

 

I would like to plot multiple line on one graph, but I can't do it with simple "line chart".

 

I have only one dataset, and what I want to do is to use lines to represent different filters.

I included few filters which are the same for all lines, but each line will have different filter for one collumn.

So, to be simple: I am using 4 filters for my dataset, and for all lines 3 filters are the same, but the lines are different because 4th filter is unique for each line (example: Collumn A = "1" for line A; Collumn A="2" for line B etc.)

 

Hope I could explain it well enough,

 

Looking forward for your answer!

10 REPLIES 10
alexei7
Continued Contributor
Continued Contributor

Hi nn92,

 

You can do this. You will need to create different measures for each of the lines you want on your line chart.

The measures can each have their unique filters, and then you would use the filters that affect all of the measures as part of the page/report filters.

 

If you look at the CALCULATE function that will probably be the one you'll use to create the measures.

 

Hope that helps

Alex

nn92
Frequent Visitor

Thanks for the answer!

 

Do you maybe know if there is some custom visualisation which can help with this?

 

I am not so into working with functions in Power BI, but I am taking some online courses...

alexei7
Continued Contributor
Continued Contributor

I'm not aware of any custom visualisation, but this shouldnt be too hard to do.

If you post your data or some sample data, that'd be really helpful and me or someone else here could help with your formulas.

 

Alex

nn92
Frequent Visitor

Hi,

 

 

I attached you the current setings, if you could help, I would appreciate a lot.

 

I need to keep everything the same, only change the "ADEP is LEMD" into "ADEP is XXXX" and plot several same lines on one graph?

 

***edit: Table name is: TRP-Visual

 

Many thanks in advance!

 

 

 

 

nikola_image.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

alexei7
Continued Contributor
Continued Contributor

Hi @nn92

 

I can't see everything in the screenshot you posted. If you can upload/post your model that would be helpful.

 

Your formulas would look something like this for each measure:

 

LEMD = calculate(countrows(RESERVATION_....),filter(ADEP="LEMD")

XXXX  = calculate(countrows(RESERVATION_....),filter(ADEP="XXXX") etc

 

Hope that helps,

Alex

nn92
Frequent Visitor

Hi, @alexei7 ,

thanks for trying to help!

 

I posted bigger screenshot, with more info. Could you please tell me where exactly I need to type in this filter, and where to create new line (if it is under tabel->edit query...) or something ele?

 

THanks in advance!

nikola_image.png

 

 

alexei7
Continued Contributor
Continued Contributor

Hi @nn92,

 

These are measures not filters.

One way you can create them is by right-clicking on the table and selecting "New Measure".

 

If you're able to remove any confidential information and share the model, I'm happy to help create the measures for you.

 

Alex

nn92
Frequent Visitor

@alexei7  maybe this could help?

 

Problem is that my dataset is few GBs, so the model has 200mb and I cant upload it so easily.

 

Maybe this could help:

Axis = lead_time

Legent = RESERVATION_CASE_DESC

Values = Count of RESERVATION_CASE_DESC

Filters = ADEP is LEMD    ***this is the one I want to vary for different lines

              RESERVATION_CASE_DESC is True Revision

 

Table name is "TRP-visual"

 

Is this enough to write measure in the code? It takes a lot of space so I cant upload, sorry...

alexei7
Continued Contributor
Continued Contributor

@nn92 - we may have to give up after this, it's quite hard to do this remotely!

 

Give this a go and see if this works as a measure for LEMB to put in your graph.

 

LEMB = CALCULATE(count('TRP-visual'[RESERVATION_CASE_DESC]),FILTER('TRP-visual',''TRP-visual'[ADEP]="LEMB"))

If it works, you should be able to adapt it for other values.


Good luck,

Alex

nn92
Frequent Visitor

@alexei7

Many thanks for the proposed solution! 

I created a new measure and it is now on the list with all the columns. But I tried to drag&drop it, and there was nothing new displayed.. Am I doing something wrong?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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