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
rachel_luiz
New Member

How to include data from two variables in the same chart

How do I put data on a Likert scale (grades 1 to 5) from the same applied research in 2 consecutive years? The sum of all bars (2018 + 2019) gives 100%, but I would like the data for each year to add up to 100%

Imagem1.jpg

 

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @rachel_luiz 

According to your description and sample picture, I think you want to get the value in the column chart that shows the Percentage of the total group by year. Right? You can achieve this using this measure:

This is my test data based on your sample picture:

v-robertq-msft_0-1611214831269.png

Value1 =

var _total=

CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),[Year]=MAX('Table'[Year])))

var _value=

MAX('Table'[Value])

return DIVIDE(_value,_total)

Then go to the Column chart and replace the Value1 with the field in the “Value”, like this:

v-robertq-msft_1-1611214831278.png

And you can get what you want.

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
rachel_luiz
New Member

Hi @parry2k ! 

Actually, I wanted the bars to appear next to each other, because I'm comparing different years. I think this chart would be very good if the data were complementary, but in my case they are more comparative.

 

Anyway, thank you very much for your answer!

 

v-robertq-msft
Community Support
Community Support

Hi, @rachel_luiz 

According to your description and sample picture, I think you want to get the value in the column chart that shows the Percentage of the total group by year. Right? You can achieve this using this measure:

This is my test data based on your sample picture:

v-robertq-msft_0-1611214831269.png

Value1 =

var _total=

CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),[Year]=MAX('Table'[Year])))

var _value=

MAX('Table'[Value])

return DIVIDE(_value,_total)

Then go to the Column chart and replace the Value1 with the field in the “Value”, like this:

v-robertq-msft_1-1611214831278.png

And you can get what you want.

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-robertq-msft !

This was exactly what I needed!

Thank you very much for your help!! 😉

 

 

 

parry2k
Super User
Super User

@rachel_luiz not sure if I understood, maybe you are looking for 100% stacked bar chart.

 

parry2k_0-1611022340724.png

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.