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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
IAM
Helper III
Helper III

DAX cumulative date AND location, second filter isn't working

Hi all,

 

I figured out a formula to calculate the cumulative of new and closed orders. 

 

It seems to work, but when I calculate myself, it is off.

So the month of January 755 cumulative is correct, but the month of February should be 1327, not 1426

 

This happens because the filter for the terminal isn't working. Can anyone tell me what I need to change in my formula?

 

Schermafbeelding 2022-04-08 100242.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @IAM ,

Please update the formula of measure [Cumulative] as below and check whether that can return the correct result...

Cumulative =
CALCULATE (
    SUM ( 'Calculate1'[NewWorkorders] ),
    FILTER (
        ALL ( 'Calculate1' ),
        'Calculate1'[First day] <= EARLIER ( 'Calculate1'[First day] )
            && 'Calculate1'[Terminal] = EARLIER ( Calculate1[Terminal] )
    )
)
    - CALCULATE (
        SUM ( 'Calculate1'[closedWorkorders] ),
        FILTER (
            ALL ( 'Calculate1' ),
            'Calculate1'[First day] <= EARLIER ( 'Calculate1'[First day] )
                && 'Calculate1'[Terminal] = EARLIER ( Calculate1[Terminal] )
        )
    )

If the above one can't help you get the desired result, please provide some sample data in Calculate1 table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@IAM , the Number is correct as per your formula, Can share the logic ?


Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Sadly I cannot share this..

 

The problem is the red part of the formula. It isn't using this part of the filter.

 

It should filter out only the terminal as the name of the terminal that is on that row.

Cumulative =
CALCULATE(
SUM('Calculate1'[NewWorkorders] ),
FILTER (ALL ('Calculate1'),
'Calculate1'[First day] <= EARLIER('Calculate1'[First day])
&& 'Calculate1'[Terminal] = Calculate1[Terminal]))
-
CALCULATE(
SUM('Calculate1'[closedWorkorders] ),
FILTER ( ALL ('Calculate1'),
'Calculate1'[First day] <= EARLIER('Calculate1'[First day])
&& 'Calculate1'[Terminal] = Calculate1[Terminal]))
Anonymous
Not applicable

Hi @IAM ,

Please update the formula of measure [Cumulative] as below and check whether that can return the correct result...

Cumulative =
CALCULATE (
    SUM ( 'Calculate1'[NewWorkorders] ),
    FILTER (
        ALL ( 'Calculate1' ),
        'Calculate1'[First day] <= EARLIER ( 'Calculate1'[First day] )
            && 'Calculate1'[Terminal] = EARLIER ( Calculate1[Terminal] )
    )
)
    - CALCULATE (
        SUM ( 'Calculate1'[closedWorkorders] ),
        FILTER (
            ALL ( 'Calculate1' ),
            'Calculate1'[First day] <= EARLIER ( 'Calculate1'[First day] )
                && 'Calculate1'[Terminal] = EARLIER ( Calculate1[Terminal] )
        )
    )

If the above one can't help you get the desired result, please provide some sample data in Calculate1 table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

How to upload PBI in Community

Best Regards

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.