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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
RexaZii93
Helper I
Helper I

How to sum value for fixed years

 

Hi

I have a data table which has multiple years in it (2019 to 2022).

I would like to have a measure that if I chose the slicer from Jan 2022 to May 2022 on my date filter it should sum the vlaues on 2019, 2020 and 2021 years each for only Jan to May on these years so I can compare it in a chart. It also should be fixed on these years no substracting them.

 

This's what I have but it shows blank data:

 

CALCULATE (
SUM ( 'AMS Flights Data'[Total Pax (Manifest)] ),
FILTER (
ALLSELECTED ( 'AMS Flights Data' ),
'AMS Flights Data'[Actual.1].[Year] = 2019
)
)
 

Please help

 

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @RexaZii93 ,

 

You need create an independent calendar table first which has no relationship with the fact table. The same as the following screenshot.

vchenwuzmsft_0-1655190042205.png

Then create a measure like this:

Measure =
CALCULATE (
    SUM ( 'Fact table'[Values] ),
    FILTER (
        VALUES ( 'CALENDAR'[Date] ),
        MONTH ( [Date] )
            IN VALUES ( 'New calendar'[Month] )
                && DAY ( [Date] ) IN VALUES ( 'New calendar'[Day] )
    )
)

 

Result:

vchenwuzmsft_1-1655190144194.png

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

4 REPLIES 4
v-chenwuz-msft
Community Support
Community Support

Hi @RexaZii93 ,

 

You need create an independent calendar table first which has no relationship with the fact table. The same as the following screenshot.

vchenwuzmsft_0-1655190042205.png

Then create a measure like this:

Measure =
CALCULATE (
    SUM ( 'Fact table'[Values] ),
    FILTER (
        VALUES ( 'CALENDAR'[Date] ),
        MONTH ( [Date] )
            IN VALUES ( 'New calendar'[Month] )
                && DAY ( [Date] ) IN VALUES ( 'New calendar'[Day] )
    )
)

 

Result:

vchenwuzmsft_1-1655190144194.png

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

tamerj1
Super User
Super User

Hello Tamer

The post only shows how to calculate the values in the past three years (-3) so if I want a certain year lets say 2019 I would have to change -3 to -4 every year.

what I would like is to calculate values on fixed year lets say 2019. Moreover, it only calculate the months I Pick on my callendar date, so if I chose Jan to July for 2022 it automatically do the same for 2019.

@RexaZii93 

Please provide sample file with dummy data to work with. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.