cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

2 slicer graph, Company name & Attribute

Hi all, 

 

Currently I want to add a line graph with multiple lines. It depends how many 'companies' are selected and how many 'attributes' to be shown are selected. Currently my model does work with 1 slicer, so if I tick an additional attribute another line is plotted. So far so good. 

 

However, from the moment I add another company Powerbi sums all attribute values. So instead of plotting an additional line for company A sales and company B sales, it's summing A&B. I tried to unpivot columns already, but unfortunately it messes up my data. I will add some screenshots. 

 

Thanks for all the help already!1.PNG2.png3.PNG

4 REPLIES 4
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try to create a calculated column in your table to combine [Company] and [Attribute]:

Column = 'Table'[Company]&"-"&'Table'[Attribute]

Then choose this column as Legend field, when you select more than one company in slicer, it shows the single value for each company but not the sum:

5.PNG

Here is my test pbix file:

pbix 

Hope this helps.

 

Best Regards,

Giotto Zhi

 

Hi @Anonymous ,

 

The solution with measures is the same as with the columns, you need to make a measure for each combination between KPI and company so you would need 75 company vs 7 KPI.

 

Looking at the information you are giving you can have up to 525 lines in your visualization not reallt sure if this is the best option to have on a visualization, because the user can select any amount of company's / KPI.

 

Can you explain a little better what is the final purpose for not creating the 525 options.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



MFelix
Super User
Super User

Hi  @Anonymous ,

 

On legend visualization you don't have the possibility to have to levels that is basically what you are trying yo achieve that is having a value for Attribute Per company you have two possibilities.

 

To create measure for each of the company/attribute and used them as your values in the chart and then create a switch measure to turn on and off.

 

Another solution that I believe is easier is to create a new column with the concatenation of Company - Attribute then use this as your legend on your visualization that will allow a line per attribute per company.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Thanks MFelix, if I do understand you correctly: the concatenation is indeed a solution. However, my list is longer than 2 companies... I have 75 companies. Which will result in an endless list of variables, which doesn't add value. Do you have an example of the first solution? video and or code? Thanks for your fast reply!  

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.