Forum Discussion

eng_123's avatar
eng_123
Frequent Visitor
1 year ago
Solved

Add text value in bar chart instead of integer value

Need assitance for a bar chart in x axis instead of using a measure (used as count distinct) for status could we use text value to be displayed of Pass or Fail. 

 

From

 

 

To

 

If this cannot be done in bar chart please let me know if any other visual could be used to achieve this.

 

unable to Attach  PBIX file but below is tables to enter in power bi desktop.

 

ApplicationStatus
App 1Pass
App 10Pass
App 2Pass
App 3Fail
App 4Fail
App 5Fail
App 6Fail
App 7Pass
App 8Pass
App 9Pass

 

 

 

 

  • Hey eng_123,

    Looking at your images, I can see you want to display "Pass" and "Fail" text labels on your bars instead of the count values. This is definitely achievable in Power BI! Here are several approaches:

    Method 1: Data Labels with Custom Text (Recommended)

    1. Select your bar chart and go to the Format pane
    2. Turn on Data labels
    3. In Data labels settings, change the Value dropdown from "Auto" to a field that contains your Pass/Fail text
    4. If you don't have a separate text field, create a calculated column or measure:

    Status Text =
    IF([Status] = 1, "Pass", "Fail")

     

    Method 2: Create a Status Text Column

    If your current Status field is numeric (1/0), create a new calculated column:

     

    Status Label =
    SWITCH([Status],
    1, "Pass",
    0, "Fail",
    "Unknown"
    )

    Then use this new column in your data labels.

    Method 3: Alternative Visuals

    If the bar chart doesn't work perfectly, consider these alternatives:

    • Stacked Bar Chart: Shows Pass/Fail segments clearly
    • Table Visual: Simple and clear display of status by app
    • Matrix Visual: Good for showing status across multiple dimensions
    • Custom Visual: Consider "Bullet Chart" or "Linear Gauge" from AppSource

    Method 4: Conditional Formatting

    You can also:

    1. Keep the numeric values but use conditional formatting
    2. Set background colors (green for Pass, red for Fail)
    3. Use data bars with custom colors

    Quick Fix for Your Current Chart

    1. Go to FormatData labelsOn
    2. Under Value, select your status field
    3. Under Display units, choose "None"
    4. Create a simple measure:

    Status Display = IF(MAX([Status]) = 1, "Pass", "Fail")

     

    Fixed? Mark it • Share it • Help others!

     

    Best Regards,

    Jainesh Poojara | Power BI Developer

2 Replies

  • jaineshp's avatar
    jaineshp
    Memorable Member

    Hey eng_123,

    Looking at your images, I can see you want to display "Pass" and "Fail" text labels on your bars instead of the count values. This is definitely achievable in Power BI! Here are several approaches:

    Method 1: Data Labels with Custom Text (Recommended)

    1. Select your bar chart and go to the Format pane
    2. Turn on Data labels
    3. In Data labels settings, change the Value dropdown from "Auto" to a field that contains your Pass/Fail text
    4. If you don't have a separate text field, create a calculated column or measure:

    Status Text =
    IF([Status] = 1, "Pass", "Fail")

     

    Method 2: Create a Status Text Column

    If your current Status field is numeric (1/0), create a new calculated column:

     

    Status Label =
    SWITCH([Status],
    1, "Pass",
    0, "Fail",
    "Unknown"
    )

    Then use this new column in your data labels.

    Method 3: Alternative Visuals

    If the bar chart doesn't work perfectly, consider these alternatives:

    • Stacked Bar Chart: Shows Pass/Fail segments clearly
    • Table Visual: Simple and clear display of status by app
    • Matrix Visual: Good for showing status across multiple dimensions
    • Custom Visual: Consider "Bullet Chart" or "Linear Gauge" from AppSource

    Method 4: Conditional Formatting

    You can also:

    1. Keep the numeric values but use conditional formatting
    2. Set background colors (green for Pass, red for Fail)
    3. Use data bars with custom colors

    Quick Fix for Your Current Chart

    1. Go to FormatData labelsOn
    2. Under Value, select your status field
    3. Under Display units, choose "None"
    4. Create a simple measure:

    Status Display = IF(MAX([Status]) = 1, "Pass", "Fail")

     

    Fixed? Mark it • Share it • Help others!

     

    Best Regards,

    Jainesh Poojara | Power BI Developer

  • eng_123's avatar
    eng_123
    Frequent Visitor

     Thank you changed it and seems to work fine now