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
Dannismen
Helper I
Helper I

Cumulative/YTD formulas wrong

Hi everyone. 

 

I've used this formula to calculate ytd value but somehow at March 28th, 2021 it always gave me a spike it shouldn't have. 

 

Can someone plz help me on the formula?

 

https://drive.google.com/file/d/1ttQDeOPGBzaigUO3b-FGcH4Dio4HuDiY/view?usp=sharing

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

FYTD = 
VAR __to = MAX( Combined[fiscal_BOW] )
VAR __from =
    MINX(
        CALCULATETABLE(
            Combined,
            ALL( Combined[fiscal_BOW] ),
            Combined[fiscal_BOW] <= __to
        ),
        Combined[fiscal_BOW]
    )
RETURN
    CALCULATE(
        SUM( Combined[Metric_Value] ),
        DATESBETWEEN( Combined[fiscal_BOW], __from, __to )
    )

Screenshot 2021-05-31 033111.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

FYTD = 
VAR __to = MAX( Combined[fiscal_BOW] )
VAR __from =
    MINX(
        CALCULATETABLE(
            Combined,
            ALL( Combined[fiscal_BOW] ),
            Combined[fiscal_BOW] <= __to
        ),
        Combined[fiscal_BOW]
    )
RETURN
    CALCULATE(
        SUM( Combined[Metric_Value] ),
        DATESBETWEEN( Combined[fiscal_BOW], __from, __to )
    )

Screenshot 2021-05-31 033111.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Dannismen
Helper I
Helper I

Formula:
 
Cumulative Value =
CALCULATE( sum(Combined[Metric_Value]),
FILTER( Combined,
Combined[Fiscal_BOW] <= EARLIER(Combined[Fiscal_BOW])
&& Combined[fiscal_year] = EARLIER(Combined[fiscal_year])
&& Combined[Metric_Name] = EARLIER(Combined[Metric_Name])
&& Combined[standardized_name] = EARLIER(Combined[standardized_name])
&& Combined[DPR_Entity] = EARLIER(Combined[DPR_Entity])))

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!

November Carousel

Fabric Community Update - November 2024

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

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.