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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Agreenwood
Helper I
Helper I

DAX - Using Filter to Sum All Months by Working Day

Hi,

 

Fairly new to DAX and been frustrated all day trying to figure this one out. There is probably a simple answer.

 

I have a 'Dates' table which has 2 columns: 1) 'Date' (2) 'Working Day' which holds the working day number of the month

 

I have a second table 'Revenue' which has 2 columns: 1) 'Date' (2) 'Daily Revenue'

 

There is a relationship between the two tables, on date.

 

I want to display in a report a filter on "Working Day", and a table/graph showing monthly revenue for all days up until the working day that is selected in the filter.

 

In Excel: =SUMIFS(Revenues[Revenue], Dates[Working Day], "<=" & SelectedWorkingDay)

 

In Power BI I have attempted many variations and combinations of failing measures, though my closest attempt is:

 

MtD Revenue = CALCULATE(SUM(Revenues[Revenue]), FILTER(ALL(Dates), Dates[workingday] <= MAX(Dates[workingday])))

 

However, this sums all revenue for all months before the selected working day, and does not sum the revenue for the individual month in the visualisation.

 

I have also attempted to use the EARLIER() function in a calculated column, though using this solution I can not use the working day filter on the dashboard.

 

Thank you in advance for your help... 

1 ACCEPTED SOLUTION

Hi @Agreenwood,

 

According to your formulas, it seems the monthly revenue will be accumulated. Maybe you can try these formula below. You can check it out in this file

Measure 2 =
TOTALYTD (
    SUM ( Revenues[Revenue] ),
    Dates[Date],
    FILTER ( ALL ( 'Dates' ), 'Dates'[WorkingDay] <= MAX ( Dates[WorkingDay] ) )
)
Measure =
TOTALMTD ( SUM ( Revenues[Revenue] ), 'Dates'[Date] )

DAX_Using_Filter_to_Sum_All_Months_by_Working_Day

 

Best Regards,

Dale

Community Support Team _ Dale
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
Agreenwood
Helper I
Helper I

Ok, I think I may have answered my own question with the following measure:

 

MtD Revenue = CALCULATE(SUM(Revenue[Revenue]), FILTER(ALL(Dates), Dates[workingday] <= MAX(Dates[workingday])), FILTER(ALL(Dates), Dates[Date] <= MAX(Revenue[date])))

 

Are there any alternative ways of completing the same, or better ways maybe?

Hi @Agreenwood,

 

According to your formulas, it seems the monthly revenue will be accumulated. Maybe you can try these formula below. You can check it out in this file

Measure 2 =
TOTALYTD (
    SUM ( Revenues[Revenue] ),
    Dates[Date],
    FILTER ( ALL ( 'Dates' ), 'Dates'[WorkingDay] <= MAX ( Dates[WorkingDay] ) )
)
Measure =
TOTALMTD ( SUM ( Revenues[Revenue] ), 'Dates'[Date] )

DAX_Using_Filter_to_Sum_All_Months_by_Working_Day

 

Best Regards,

Dale

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.