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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
NadeemAhamed
Helper V
Helper V

showing Data labels based on the conditions

Dear All,

 

I have created Line and clustered column chart vistual

I want to show the Data labels for the Y-Axis based on conditions (only for the selected month data) for other month only line should be there. 

NadeemAhamed_5-1713780054592.png

 

 

I have attached pbix and excel for your reference. 

Excel: https://toyotsu.box.com/s/wbkdanpgs96h5g2ktzxfn0qssbokb18v

Pbix: https://toyotsu.box.com/s/89e0wmc1ng9944zt5j9ocqvwvwtclqkd

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @NadeemAhamed ,

Please create these new measures:

Actual Cumulative Data Labels = 
VAR __slicer = ALLSELECTED('Month'[Month])
VAR __cur_month = SELECTEDVALUE('Monthly'[Monthly])
VAR __result = IF(__cur_month IN __slicer, SUM('Sheet1'[Actual Cumulative]))
RETURN
__result
Plan Cumulative Data Labels = 
VAR __slicer = ALLSELECTED('Month'[Month])
VAR __cur_month = SELECTEDVALUE('Monthly'[Monthly])
VAR __result = IF(__cur_month IN __slicer, SUM('Sheet1'[Plan Cumulative]))
RETURN
__result

And then please apply it to the data label's value:

vcgaomsft_0-1713837757104.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @NadeemAhamed ,

Please create these new measures:

Actual Cumulative Data Labels = 
VAR __slicer = ALLSELECTED('Month'[Month])
VAR __cur_month = SELECTEDVALUE('Monthly'[Monthly])
VAR __result = IF(__cur_month IN __slicer, SUM('Sheet1'[Actual Cumulative]))
RETURN
__result
Plan Cumulative Data Labels = 
VAR __slicer = ALLSELECTED('Month'[Month])
VAR __cur_month = SELECTEDVALUE('Monthly'[Monthly])
VAR __result = IF(__cur_month IN __slicer, SUM('Sheet1'[Plan Cumulative]))
RETURN
__result

And then please apply it to the data label's value:

vcgaomsft_0-1713837757104.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

@Anonymous 

 

Thank you for your solution. 

Its working. 

johnbasha33
Super User
Super User

  

To show data labels for the Y-Axis based on conditions (only for the selected month data) in a Line and Clustered Column Chart visual, you can use a combination of measures and conditional formatting.

Here's a general approach you can follow:

  1. Create Measures: Create measures for the data you want to display as data labels. You can use DAX functions like IF, SWITCH, or SELECTEDVALUE to conditionally show data labels based on your criteria.

  2. Add Measures to Data Labels: Add your measures to the "Data labels" section of your visual. This will display the data labels for each data point on the chart.

  3. Apply Conditional Formatting: Use conditional formatting on your measures to control when the data labels should be displayed. You can use DAX functions within the measures to determine if the data labels should be shown for the selected month or not.

    Here's an example of how you might set up your measures:

     

    DAXCopy code
    SelectedMonthDataLabel = IF ( MAX ( 'YourDateTable'[Month] ) = SELECTEDVALUE ( 'YourDateTable'[Month] ), [YourMeasure], -- Display measure for selected month BLANK () -- Don't display data label for other months )
     

    Replace 'YourDateTable'[Month] with the column reference to your date/month field, and [YourMeasure] with the measure you want to display as the data label.

    Once you have your measures set up, add them to the "Data labels" section of your Line and Clustered Column Chart visual. Then, apply conditional formatting to control when the data labels should be displayed based on your criteria.

    By following these steps, you should be able to achieve the desired behavior of showing data labels for the Y-Axis based on conditions for the selected month data in your visual.

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

  4.  

  5.  

@NadeemAhamed

Dear @johnbasha33

 

Thank you for your valuable time to read and reply my query. 

 

I have tried this above method but it will show only selected values in line but line are missing for the other month.  

 

NadeemAhamed_0-1713787339948.png

I have updated the same pbix file for your reference. 

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.