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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. 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

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

Community Support Team _ Rena
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

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.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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]))

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

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

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.