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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Jkaelin
Resolver I
Resolver I

DatesYTD isn't working

Good afternoon,

 

I have a YTD that isn't working correctly.  If a forecast value is not available, then it should return the actual revenue value.  The picture below shows that works well.  However, I'm trying to get the forecast YTD value to aggregate correctly.  Instead, the forecast YTD is cumulating the revenue (Jan - Mar) & then resets & then cumulates the forecast value for the remainder of the year.  

 

I've tried various YTD measures & "if blank" logic, but to no avail. 

 

YTD.PNG

 

Incorrect Measure(s):

 

Forecast :=CALCULATE(IF(ISBLANK([Monthly Revenue]),[Monthly Forecast],[Monthly Revenue]))

 

YTD Forecast :=CALCULATE([Forecast],DATESYTD(dimDate'[Date]))

 

Any thoughts?  Tips?  Suggestions?

 

Kindly - James

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

Hi @Jkaelin,

 

I made one sample for your reference. Creating the measures as below.

 

Monthly Forecast = SUM(Table1[Forecast])
Monthly Revenue = SUM(Table1[Revenue])
Forecast M = IF(ISBLANK([Monthly Revenue]),[Monthly Forecast],[Monthly Revenue])
Measure =
VAR a =
    TOTALYTD ( [Monthly Revenue], dimDate[Date] )
VAR b =
    TOTALYTD (
        CALCULATE (
            [Monthly Forecast],
            FILTER ( Table1, [Monthly Revenue] = BLANK () )
        ),
        dimDate[Date]
    )
RETURN
    IF ( ISBLANK ( [Monthly Revenue] ), a + b, a )

Capture.PNG

 

Also attached the pbix for your reference. If it doesn't meet your requirement, kindly share your sample data and excepted result to me.

 

Regards,

Frank

 

 

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

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @Jkaelin,

 

I made one sample for your reference. Creating the measures as below.

 

Monthly Forecast = SUM(Table1[Forecast])
Monthly Revenue = SUM(Table1[Revenue])
Forecast M = IF(ISBLANK([Monthly Revenue]),[Monthly Forecast],[Monthly Revenue])
Measure =
VAR a =
    TOTALYTD ( [Monthly Revenue], dimDate[Date] )
VAR b =
    TOTALYTD (
        CALCULATE (
            [Monthly Forecast],
            FILTER ( Table1, [Monthly Revenue] = BLANK () )
        ),
        dimDate[Date]
    )
RETURN
    IF ( ISBLANK ( [Monthly Revenue] ), a + b, a )

Capture.PNG

 

Also attached the pbix for your reference. If it doesn't meet your requirement, kindly share your sample data and excepted result to me.

 

Regards,

Frank

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Hi @v-frfei-msft,

i tried testing the same and i am able to recreate what james was talking about.

i also checked your file "Dates YTD not working.pbix" file and is working good.Not sure if am missing something in here.

Please find the test file which i created in the below link :

 

YTD Test

 

My file see YTD Measure : 
 YTD Measure = CALCULATE([Measure],DATESYTD('Calendar'[Date]))

1.JPG

 

 

 

 

 

Regards

CLR

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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