- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Power BI desktop query - bar chart
I want to add an average line in a bar chart visual which looks like below -
Legends - Year (2023 and 2024)
condition is it should only diplay the average value for year 2023 and it should display both years data as well.
is ther any way we can achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @Alice08 ,
1. Create a measure, write an expression, and calculate the desired average. The following expression calculates the average monthly sales in 2013.
Measure =
VAR _sum = CALCULATE(SUM(financials[Sales]),FILTER(ALL('financials'),'financials'[Year] = "2013"))
VAR _num = CALCULATE(DISTINCTCOUNT('financials'[Month Number]),FILTER(ALL('financials'),'financials'[Year] = "2013"))
RETURN
DIVIDE(_sum,_num)
2. Click the magnifying glass in the visualizations pane->constant line->add line.
line -> value -> fx, put the created measure value.
3. The final result is shown in the figure below.
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @Alice08 ,
1. Create a measure, write an expression, and calculate the desired average. The following expression calculates the average monthly sales in 2013.
Measure =
VAR _sum = CALCULATE(SUM(financials[Sales]),FILTER(ALL('financials'),'financials'[Year] = "2013"))
VAR _num = CALCULATE(DISTINCTCOUNT('financials'[Month Number]),FILTER(ALL('financials'),'financials'[Year] = "2013"))
RETURN
DIVIDE(_sum,_num)
2. Click the magnifying glass in the visualizations pane->constant line->add line.
line -> value -> fx, put the created measure value.
3. The final result is shown in the figure below.
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Use the "Line and Clustered Column Chart" and provide your own measure for the 2023 average (as the line)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Can you elaborate please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
09-30-2023 06:30 AM | |||
03-28-2024 07:43 AM | |||
08-19-2024 11:08 PM | |||
05-19-2024 04:34 PM | |||
07-29-2024 03:51 AM |
User | Count |
---|---|
131 | |
104 | |
85 | |
55 | |
46 |