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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
am_i_really
Frequent Visitor

SUM and filter by month

Hi All, 

 

I'm new to DAX and am having some trouble with this measure:

 

I need to SUM 3 columns from different tables, however when I apply a month filter to the page it does not filter the SUM value so I am looking for a solution to filter the measure by month. I have a date table and would like to filter by Month_Year.

 

Total Budget = CALCULATE(SUM('Catering Budget'[Catering Budget]) + SUM('Dining Subsidy'[Dining Budget]) + SUM('Office Coffee Budget'[Office Coffee Budget]))
 
Thanks in advance!


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

Hi @am_i_really ,

 

I suggest you to create a calendar table and then create relationships between "Calendar" and these three tables.

Calendar = 
ADDCOLUMNS (
    CALENDARAUTO (),
    "Year", YEAR ( [Date] ),
    "Month", MONTH ( [Date] ),
    "Month_Year", FORMAT ( [Date], "MMMM_YYYY" ),
    "YearMonth",
        YEAR ( [Date] ) * 100
            + MONTH ( [Date] )
)

vrzhoumsft_0-1683703521992.png

Result is as below.

vrzhoumsft_1-1683703541111.pngvrzhoumsft_2-1683703549817.png

 

Best Regards,
Rico Zhou

 

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

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @am_i_really ,

 

I suggest you to create a calendar table and then create relationships between "Calendar" and these three tables.

Calendar = 
ADDCOLUMNS (
    CALENDARAUTO (),
    "Year", YEAR ( [Date] ),
    "Month", MONTH ( [Date] ),
    "Month_Year", FORMAT ( [Date], "MMMM_YYYY" ),
    "YearMonth",
        YEAR ( [Date] ) * 100
            + MONTH ( [Date] )
)

vrzhoumsft_0-1683703521992.png

Result is as below.

vrzhoumsft_1-1683703541111.pngvrzhoumsft_2-1683703549817.png

 

Best Regards,
Rico Zhou

 

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

 

eliasayyy
Super User
Super User

Hello are you sure you made relationship between the tables?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.