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
hackfifi
Helper V
Helper V

Average Line in Column Chart not calculating

Good Day - I am strugging to get an STRAIGHT Average Line for a measure irrespective of the X axis.

I have a measure which calculates the average correctly i.e. shown in the image/card as 2.03

When i add the measure as a line, it reverts to the data based on the X axis. I just want the 2.03 to be a straight line across the graph for the selected data. Kindly note i have selected 3 projects below; but i have a dropdown with 100+ projects.

Avg PF = CALCULATE(AVERAGEX(Projects,[PF]),ALLSELECTED(Projects[Project]))

Thanks

 

 

Average Line Query.png

1 ACCEPTED SOLUTION

HI  @hackfifi 

Just add a IF conditional in formula as below:

Avg PF = 
IF(NOT(VALUES(Projects[Project])) IN VALUES('Exclude Projects'[Project]), 
CALCULATE(AVERAGEX(Projects,[PF]),ALLSELECTED(Projects)))

Result:

3.JPG

 

Regards,

Lin

Community Support Team _ Lin
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

5 REPLIES 5
amitchandak
Super User
Super User

@hackfifi , Use

Avg PF = CALCULATE(AVERAGEX(Projects,[PF]),ALLSELECTED(Projects))

 

On more query, if i had ANOTHER TABLE "Exclude Projects" with data values as Project 1, Project 2, Project 3 etc which is NOT related to MASTER PROJECT TABLE, is possible to calculate the average excluding the selected projects from "Exclude Projects"

 

For example, if i select "Project 3" from "Exclude Projects" slicer, i would like the average line to show only average of Project 1 & Project 2.

 

Thanks mate!!

HI  @hackfifi 

Just add a IF conditional in formula as below:

Avg PF = 
IF(NOT(VALUES(Projects[Project])) IN VALUES('Exclude Projects'[Project]), 
CALCULATE(AVERAGEX(Projects,[PF]),ALLSELECTED(Projects)))

Result:

3.JPG

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
danextian
Super User
Super User

Hi @hackfifi ,

I am not quite sure what you are trying to accomplish. Are you trying to get the average for each project (as there is only project 1 in your x axis) or the average for all projects? Insted of  ALLSELECTED ( Projects[Project] ), you could try:

  • ALLEXCEPT( Projects, Projects[Project] )
  • or ALL ( Projects[Project] )









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


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Sorry Mate - it is actually Project 1, Project 2, Project 3 etc.

 

I would like to get AVERAGE of ALL Projects. The measure works as shows in the DATA LABEL as 2.03, but when i add that AVERAGE measure to chart, it calculates by project.

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.

Top Solution Authors