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
akt
Frequent Visitor

Secondary y-axis: calculated average, how not to display those categories in primary axis & legend

I have created a measure to calculate a monthly average for years 2018 and 2019 that I would like to visualize on the secondary axis to compare to monthly counts for more current years (2020-2024) but I don't want the bars for those years (2018-2019) included in the legend/visualized on the graph. However if I filter to exclude those years, my average line also disappears. I have tried to use ALL() and REMOVEFILTERS() on both the counts and the average measures but no dice. I'm sure someone here has a better idea! Thank you!

akt_0-1709763212421.png

 

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

Hi, @akt 

If you want not to display the values on the Line y-axis, you can turn off the display of data labels in visual >> Data label:

vjianpengmsft_0-1709782962651.png

If the value you want to display is the value of your measure, rather than a specific month, try using the following DAX expression:

 

Average_2018_2019 = 
CALCULATE(
    AVERAGE(Table[Value]),
    FILTER(
        ALL(Table[Year]),
        Table[Year] IN {2018, 2019}
    )
)

 

If you don't want to display COUNT1819AVG in the legend, I haven't found any switch to turn off the line Y-axis in the legend. Here is a possible alternative:

vjianpengmsft_1-1709787144928.png

vjianpengmsft_2-1709787185069.png

vjianpengmsft_3-1709787231826.png

vjianpengmsft_4-1709787272696.png

vjianpengmsft_5-1709787356445.png

Turn off the legend field in the original chart and use an independent legend visual, so that the COUNT1819AVG field is not displayed in the legend of the chart.

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

1 REPLY 1
v-jianpeng-msft
Community Support
Community Support

Hi, @akt 

If you want not to display the values on the Line y-axis, you can turn off the display of data labels in visual >> Data label:

vjianpengmsft_0-1709782962651.png

If the value you want to display is the value of your measure, rather than a specific month, try using the following DAX expression:

 

Average_2018_2019 = 
CALCULATE(
    AVERAGE(Table[Value]),
    FILTER(
        ALL(Table[Year]),
        Table[Year] IN {2018, 2019}
    )
)

 

If you don't want to display COUNT1819AVG in the legend, I haven't found any switch to turn off the line Y-axis in the legend. Here is a possible alternative:

vjianpengmsft_1-1709787144928.png

vjianpengmsft_2-1709787185069.png

vjianpengmsft_3-1709787231826.png

vjianpengmsft_4-1709787272696.png

vjianpengmsft_5-1709787356445.png

Turn off the legend field in the original chart and use an independent legend visual, so that the COUNT1819AVG field is not displayed in the legend of the chart.

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

 

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.