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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Monster
Regular Visitor

How do I show category names under the bars directly instead of using a legend?

Hi there,

 

 I created 3 measures for the sales in "Q2-2019", "Q2-2023", and "Q2-2024". Although I have turned on the x-axis, no category names are shown.  Understand we can use a legend, but I want to show "Q2-2019", "Q2-2023", and "Q2-2024" under the relevant bar directly for the sake of readiness.

 

Monster_0-1719121234621.png

 

2 ACCEPTED SOLUTIONS
vigneshba
Frequent Visitor

I hope you are expecting things as below. In that case you should try to create Calculated Dimension to have values as "Q2-2019", "Q2-2023", and "Q2-2024" according to the Date Value and use Clustered Column start by making this Calculated Dimension (in my case it's Year) in X axis and your Sales amount in Y axis. You are not required to create multiple Measurements for this scenario. Let me know if this helps you. 

vigneshba_0-1719125894065.png

 

View solution in original post

v-jingzhan-msft
Community Support
Community Support

Hi @Monster 

 

When you add three measures to a column chart, all of them will be added to Y-axis. No x-axis field exists in the chart so turning on the X-axis Values won't make the measure names display. 

 

I would prefer @vigneshba 's solution as it can avoid creating many measures for categories. 

 

However if you want to use the measures you have created, you can try my solution. Create a table to have those category names you want to display and add that column to X-axis, then create a new measure to decide which measure you want to calculate for each category. Add this measure to Y-axis. 

Measure = SWITCH(SELECTEDVALUE('Table'[Quarter]),"Q2-2019",[Q2-2019],"Q2-2023",[Q2-2023],"Q2-2024",[Q2-2024])

vjingzhanmsft_0-1719474952325.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

(Virus scan in progress ...)
3 REPLIES 3
v-jingzhan-msft
Community Support
Community Support

Hi @Monster 

 

When you add three measures to a column chart, all of them will be added to Y-axis. No x-axis field exists in the chart so turning on the X-axis Values won't make the measure names display. 

 

I would prefer @vigneshba 's solution as it can avoid creating many measures for categories. 

 

However if you want to use the measures you have created, you can try my solution. Create a table to have those category names you want to display and add that column to X-axis, then create a new measure to decide which measure you want to calculate for each category. Add this measure to Y-axis. 

Measure = SWITCH(SELECTEDVALUE('Table'[Quarter]),"Q2-2019",[Q2-2019],"Q2-2023",[Q2-2023],"Q2-2024",[Q2-2024])

vjingzhanmsft_0-1719474952325.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

(Virus scan in progress ...)
vigneshba
Frequent Visitor

I hope you are expecting things as below. In that case you should try to create Calculated Dimension to have values as "Q2-2019", "Q2-2023", and "Q2-2024" according to the Date Value and use Clustered Column start by making this Calculated Dimension (in my case it's Year) in X axis and your Sales amount in Y axis. You are not required to create multiple Measurements for this scenario. Let me know if this helps you. 

vigneshba_0-1719125894065.png

 

rajendraongole1
Super User
Super User

Hi @Monster - you can do it with the help field parameter concept by creating the x-axis and y-axis

 

I hope if you already having the date table with "Q2-2019", "Q2-2023", and "Q2-2024"... 

 

Create x-axis with field parameter from modelling tab >> new parameter >> fields 

add the year-quarter, and so on required fields. 

rajendraongole1_0-1719125801032.png

 

Another field parameters with your measures add measure : "Q2-2019", "Q2-2023", and "Q2-2024".

 

reference video FYR: Dynamic X and Y Axis in Power BI visuals? Yes please! (youtube.com)

 

It works. please check.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 

 





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

Proud to be a Super User!





Helpful resources

Announcements