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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
CL7777
Helper III
Helper III

filtering average by only year in a chart where x axis is both year and month

I have a plot as follows:

CL7777_0-1667492530369.png

In this plot, I have a measure for the Avg 2021 and Avg 2022 lines shown

:

average usage time 2021 =
    VAR lastyear = YEAR(TODAY()) - 1
RETURN
CALCULATE([% Usage Time], ALLEXCEPT('_Date rt (2)', '_Date rt (2)'[Date Month]),'_Date rt (2)'[Year] = lastyear)
 
and
 
average usage time 2022 =
    VAR thisyear = YEAR(TODAY())
RETURN
CALCULATE([% Usage Time], ALLEXCEPT('_Date rt (2)', '_Date rt (2)'[Date Month]),'_Date rt (2)'[Year] = thisyear)
 
This produces 2 lines on the plot that represent the averages for each of the last 2 years. 
 
The problem is that the averages for each year extend into the other years. what I want is something that looks like the blue line in the plot below
 
CL7777_1-1667492962836.png

 

I want one line that shows the average value of the year being plotted. I have tried multiple measures but none of them produce this result.

 

Any help anyone can offer would be greatly appreciated.

 
 

 

 

3 REPLIES 3
Bifinity_75
Solution Sage
Solution Sage

Hi @CL7777 , can you send me a screenshot with the relationships of the dates, and what date are you using for the chart?. Thanks

Bifinity_75
Solution Sage
Solution Sage

Hi @CL7777 , try this measure

Average = CALCULATE(AVERAGE('Table'[Import]),ALLEXCEPT('Table','Table'[Date].[Year]))

The result:

Bifinity_75_0-1667506682018.png

Best regards

Thanks for your reponse @Bifinity_75. The plot that shows the bar chart is actually a measure and when I use the same idea as you had above but put averagex([measure]) instead, O get an incorrect result. the measure is:

 

% Usage Time =
DIVIDE(
       SUMx(
           'JobScan', MIN('JobScan'[LaborHours], 8)) ,
            SUMx(
               '_Date rt (2)', '_Date rt (2)'[Is Working Day]
             )
      )
 
I use the expression
CALCULATE(AVERAGEX('JobScan', [% Usage Time]), ALLEXCEPT('_Date rt (2)', '_Date rt (2)'[Date].[Year]))
since it is a measure, not a table column 
 
and I get instead the following blue line, which is not the desired result)
CL7777_0-1667576719875.png

 

any ideas why this might be wrong? thank you so much

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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