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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
RES
Regular Visitor

X axis sum of matching months and year of a different column

Report MonthValueIncident
2019-08-012482022-02-15
2020-10-01251.672022-02-17
2022-01-011502022-02-08
2022-01-012002022-02-17
2022-01-012002022-02-14
2022-01-0119.52022-02-21
2022-01-012002022-02-22
2022-02-21366.62022-02-21

 

I would like to use report month on the X axis of a bar chart that sums Value of the Incident column where it is within the month.

For instance this would sum up to 1635.77 for Feb 2022 since all of these had an Incident in Feb 2022 but they were last reported on their Report Month. So the x axis will show a bar totaling 1635.77 for feb 2022 if I use Report Month. 

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

Jihwan_Kim_1-1745464784111.png

 

 

Jihwan_Kim_0-1745464764122.png

 

 

Expected result measure: = 
VAR _t =
    ADDCOLUMNS (
        CALCULATETABLE (
            data,
            REMOVEFILTERS ( 'calendar'[Year-Month sort], 'calendar'[Year-Month] )
        ),
        "@incident_end_of_month_date", EOMONTH ( data[incident_date], 0 )
    )
VAR _currentmonth =
    VALUES ( 'calendar'[Year-Month sort] )
RETURN
    SUMX (
        FILTER ( _t, [@incident_end_of_month_date] IN _currentmonth ),
        data[value]
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

v-dineshya
Community Support
Community Support

Hi @RES ,

Thanks for reaching out to the Microsoft fabric community forum.

 

Please follow below steps:

1. Create a calculated column (or create a new table if you prefer) to extract the Incident Year-Month:

Incident YearMonth = FORMAT('Table'[Incident], "YYYY-MM")
or
Incident YearMonthDate = DATE(YEAR('Table'[Incident]), MONTH('Table'[Incident]), 1)

2. Now create your bar chart: X-axis: Incident YearMonth and Y-axis: SUM of Value

DAX Measure:

Total Value By Incident Month =
VAR SelectedReportMonth = MAX('Table'[Report Month])
VAR MatchingIncidentValues =
CALCULATE(
SUM('Table'[Value]),
FILTER(
'Table',
YEAR('Table'[Incident]) = YEAR(SelectedReportMonth)
&& MONTH('Table'[Incident]) = MONTH(SelectedReportMonth)
)
)
RETURN
MatchingIncidentValues

 

Then put Report Month on the X-axis and Plot the Total Value By Incident Month measure as the Y-axis.

 

If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards

 

 

View solution in original post

5 REPLIES 5
v-dineshya
Community Support
Community Support

Hi @RES ,

Thanks for reaching out to the Microsoft fabric community forum.

 

Please follow below steps:

1. Create a calculated column (or create a new table if you prefer) to extract the Incident Year-Month:

Incident YearMonth = FORMAT('Table'[Incident], "YYYY-MM")
or
Incident YearMonthDate = DATE(YEAR('Table'[Incident]), MONTH('Table'[Incident]), 1)

2. Now create your bar chart: X-axis: Incident YearMonth and Y-axis: SUM of Value

DAX Measure:

Total Value By Incident Month =
VAR SelectedReportMonth = MAX('Table'[Report Month])
VAR MatchingIncidentValues =
CALCULATE(
SUM('Table'[Value]),
FILTER(
'Table',
YEAR('Table'[Incident]) = YEAR(SelectedReportMonth)
&& MONTH('Table'[Incident]) = MONTH(SelectedReportMonth)
)
)
RETURN
MatchingIncidentValues

 

Then put Report Month on the X-axis and Plot the Total Value By Incident Month measure as the Y-axis.

 

If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards

 

 

Hi @RES ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and consider giving a KUDOS. Feel free to reach out if you need further assistance.

 

Regards,

Dinesh

Hi @RES ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and consider giving a KUDOS. Feel free to reach out if you need further assistance.

 

Regards,

Dinesh

Hi @RES ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and consider giving a KUDOS. Feel free to reach out if you need further assistance.

 

Regards,

Dinesh

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

Jihwan_Kim_1-1745464784111.png

 

 

Jihwan_Kim_0-1745464764122.png

 

 

Expected result measure: = 
VAR _t =
    ADDCOLUMNS (
        CALCULATETABLE (
            data,
            REMOVEFILTERS ( 'calendar'[Year-Month sort], 'calendar'[Year-Month] )
        ),
        "@incident_end_of_month_date", EOMONTH ( data[incident_date], 0 )
    )
VAR _currentmonth =
    VALUES ( 'calendar'[Year-Month sort] )
RETURN
    SUMX (
        FILTER ( _t, [@incident_end_of_month_date] IN _currentmonth ),
        data[value]
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.