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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
miriamLara
Frequent Visitor

Graph Average Dax Formula by Year and last year YTD and actual year/month filtering category

Hi Everyone,

I'm trying to create the graph below with the AVERAGE SUM Incidents by Year and YTD for the actual year and actual+month. The average should consider the 12 months, not just the month with data. Filtering columns and by 'Incidents Tracker'[Category_Operations]

FILTER('Incidents Tracker','Incidents Tracker'[Show at Weekly Report] = "Yes" && ('Incidents Tracker'[Divisions for Report]= "Coke" || 'Incidents Tracker'[Divisions for Report]="Operations" )

 

I created this measure, but The avg is considering only the monthly data, and I could not put the YTD. I'm using the Calendar table.

Graph that I want to get:

miriamLara_0-1689096635328.png

 

Using the measure:

AVG By Month =
Var __Table = SUMMARIZE(FILTER('Incidents Tracker','Incidents Tracker'[Show at Weekly Report] = "Yes" && ('Incidents Tracker'[Divisions for Report]= "Coke" || 'Incidents Tracker'[Divisions for Report]="Operations" ) ),'Incidents Tracker'[Category_Operations],'Calendar'[YearMonth], "TotalIncidents",SUM('Incidents Tracker'[Total ENV Incidents Count]))
RETURN
AVERAGEX(__Table, [TotalIncidents])
 
I was able to create this graph:
I'm using the X the Calendar Column
"ReportWeekX",IF( Year([Date])<> YEAR(now()),CONVERT(YEAR([Date]),STRING),CONVERT(FORMAT([Date],"YYYY-MMM"),STRING ) )
miriamLara_1-1689096876331.png

I must include the YTD 2023 and change the measure to consider 12 months of data each year.

Can someone help me?

11 REPLIES 11
miriamLara
Frequent Visitor

DateCategoryTotal Count
4/1/2022Y1 Category0
4/2/2022Y1 Category1
4/3/2022Y1 Category0
4/5/2022Y1 Category1
4/6/2022Y1 Category0
4/7/2022Y1 Category1
4/10/2022Y1 Category1
4/11/2022Y1 Category0
4/12/2022Y1 Category1
4/13/2022Y1 Category0
4/14/2022Y1 Category1
4/15/2022Y1 Category0
4/16/2022Y1 Category0
4/17/2022Y1 Category0
4/20/2022Y1 Category0
4/21/2022Y1 Category0
4/22/2022Y1 Category1
4/25/2022Y1 Category0
4/27/2022Y1 Category0
4/29/2022Y1 Category1
4/30/2022Y1 Category0
1/3/2023Y1 Category1
1/4/2023Y1 Category2
1/6/2023Y1 Category0
1/10/2023Y1 Category1
1/12/2023Y1 Category0
1/13/2023Y1 Category0
1/16/2023Y1 Category1
1/17/2023Y1 Category0
1/19/2023Y1 Category0
1/23/2023Y1 Category0
1/24/2023Y1 Category0
1/25/2023Y1 Category0
1/26/2023Y1 Category1
1/27/2023Y1 Category0
1/28/2023Y1 Category0
1/29/2023Y1 Category2
1/30/2023Y1 Category1
1/31/2023Y1 Category1
2/1/2023Y1 Category0
2/2/2023Y1 Category0

This is your sample data

lbendlin_0-1689725781674.png

 

It is not sufficient to produce your expected outcome.

Hi @lbendlin , I tried to copy my data here, but It is more than 200,000 characters. How can I upload a file here? I can share a file in one drive but I need your email. Thanks for your help.

Yes.  Something like this?

 

lbendlin_0-1689775931551.png

 

 

I need to show in BARs the avg year divided by 12 by year, the YTD 2023 (divided by months in the year), and the Actual year avg by months in the same graph. The line is only a Target of 11.

I'm with difficulty creating the X-axis to show like the graph below in powerBi.

Like the graph below:

miriamLara_0-1689777556680.png

 

 

If you want a custom X axis you need to create a reference table with the desired values and their sort order.

 

It is a fallacy to show the same data twice on the same visual   (2023 YTD and the months of 2023).  I can't help you with that.

Thanks @lbendlin for your help and for trying to help me. I will try to create the tables references and create my own X-axis attribute to show in the graph.

miriamLara
Frequent Visitor

@lbendlin, thanks for your response

Follow the records with the monthly data samples to see if you can help me to create the Dax Average function.

 

lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot).
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.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.