Forum Discussion
How to Properly Align Labels and Values in Power BI for this particular type of visual
Hi Power BI Community,
I’m trying to create visuals in Power BI where I need to display a label and a value separately, similar to the layout in the attached screenshot. Currently, I’m following these steps:
- Inserting a shape (e.g., rectangle) as a background.
- Adding a text box on the shape for the label (e.g., "Group Selected:").
- Using a card visual to display the value (e.g., "$1,001,597,638.36").
- Aligning the text box and card visual manually
However, I’m struggling to align the label and value properly. It takes a lot of effort, and it doesn’t look neat or consistent.
This is the requirement i need them to look exactly like this and aligned proprerly,i can not use other kind of format to display this data
Since I need to create several such visuals ,I want to be efficient and ensure perfect alignment.
Is there a better approach to creating this type of visual while maintaining proper alignment? Any tips or suggestions to simplify the workflow would be greatly appreciated.
Thank you in advance!
(Screenshot attached for reference)
Hi Nithinbob24
Use a matrix viz and move the values to rows and playaround with the row header and gridlines formatting. Using the current available options in the matrix viz, this is the closest I can get to as per you image. Please see the attached sample pbix.
- Anonymous1 year ago
Hi Nithinbob24
Another approach is to use a Table visual. I guess your value fields are probably measures. In this case, you can add a table like below that has all label names to display and give them unique Label Ids.
Then create a measure similar to below. This returns the corresponding measure for each Label Id.
Selected Measure = SWITCH( SELECTEDVALUE(Labels[Label Id]), 1,[Category Selected], 2,[Group Selected], 3,[Total Amt], 4,[Total Member Count])Add the Label Name column and above measure into a Table visual. Right click on Label Name and select "Show items with no data".
Then you can
- set up the background color and text alignment for two columns separately;
- turn off Totals values;
- set up the column header text and background to white color both, and turn off Auto-size width;
- set up Style presets and Grid lines as you like.
You will have a table visual similar to that in my screenshot.
Hope this would be helpful. The sample file is attached at bottom.
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
2 Replies
- danextian
Super User
Hi Nithinbob24
Use a matrix viz and move the values to rows and playaround with the row header and gridlines formatting. Using the current available options in the matrix viz, this is the closest I can get to as per you image. Please see the attached sample pbix.
- AnonymousNot applicable
Hi Nithinbob24
Another approach is to use a Table visual. I guess your value fields are probably measures. In this case, you can add a table like below that has all label names to display and give them unique Label Ids.
Then create a measure similar to below. This returns the corresponding measure for each Label Id.
Selected Measure = SWITCH( SELECTEDVALUE(Labels[Label Id]), 1,[Category Selected], 2,[Group Selected], 3,[Total Amt], 4,[Total Member Count])Add the Label Name column and above measure into a Table visual. Right click on Label Name and select "Show items with no data".
Then you can
- set up the background color and text alignment for two columns separately;
- turn off Totals values;
- set up the column header text and background to white color both, and turn off Auto-size width;
- set up Style presets and Grid lines as you like.
You will have a table visual similar to that in my screenshot.
Hope this would be helpful. The sample file is attached at bottom.
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!