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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Lukep
Frequent Visitor

Average on a graph unaffected by day

Spoiler
Hi all,
I have created an average measure in Power BI and then using this measure have created two more measures that are 20% above and 20% below this average. This is visible in the table above the bar chart and also changes based on the day of the week selected as well as the quarter selected on the slicers below the bar chart (as shown by the first 2 screenshots).
Currently however, when i add this measure to the bar chart the average changes day by day (as shown in the 3rd screenshot). I do not want this and i want it to be able to stay the same as it is shown in the table above the bar chart but instead as a solid line all the way along the bar chart. And I only want this average to change when selecting the 2 slicers that are on the page but still remain as a solid line across the bars.

Essentially how do i get the average line highlighted in the 4th screenshot as a measure and also 2 more lines that do the same thing for 20% and 20% below that average.

Please could you advise on whether this would be possible and how i would go about doing this if so. 

Thanks


Screenshot 1Screenshot 1Screenshot 2Screenshot 2Screenshot 3Screenshot 3Screenshot 4Screenshot 4
 
1 ACCEPTED SOLUTION

@Greg_Deckler I have just used the filter to only show total visitors when the value is "not blank" and that has fixed it for me.

 

Thank you for your help with everything though!

View solution in original post

9 REPLIES 9
Greg_Deckler
Super User
Super User

@Lukep What do your measures look like? Generally you can use something along these lines:

Measure Average = AVERAGEX( ALL('Table'), [Value] )

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler, My measures look like this

 

Screenshot 5 for average footfall.png

 

Screenshot 6 for average footfall.png

@Lukep Try:

AverageFootFall = AVERAGEX( ALL('Priority Zone'), [total visitors] )

Your other measures can remain the same.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Decklerthe only issue is when i do that, the average stays the same regardless of what i select on the slicers. So it is not dynamic as I wish it to be. The graph also becomes quite gapped. 

 

Screenshot 7 for average footfall.pngScreenshot 8 for average footfall.png

@Lukep Use ALLSELECTED then instead of ALL. So like:

AverageFootFall = AVERAGEX( ALLSELECTED('Priority Zone'), [total visitors] )

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_DecklerThanks that has worked, the only thing now is the graph still looks like this.Screenshot 9 for average footfall.pngI dont suppose you know how i would go about making it so there was no gaps between the bars when only selecting one day?

 

Thanks for your help.

@Lukep Ah, well, you could try changing the x-axis to categorical instead of continuous.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler I have just used the filter to only show total visitors when the value is "not blank" and that has fixed it for me.

 

Thank you for your help with everything though!

@Lukep That's a great solution!


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.