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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
lennyt99
Helper I
Helper I

return last years DTD...

lennyt99_0-1666980926977.png

I need help bringing back lY DTD please!! 

 

My DTD measure is correct and working and is as follows: 

 

LY DTD =
IF (
HASONEVALUE ( 'Fiscal Year Conversion'[Fiscal Year] ),
CALCULATE (
SUM ( 'Opportunity Tracker 2.0'[Annual Volume LBS] ),
FILTER (
ALL ( 'Fiscal Year Conversion' ),
'Fiscal Year Conversion'[Fiscal Year] = VALUES ('Fiscal Year Conversion'[Fiscal Year] )
&& 'Fiscal Year Conversion'[Calendar Date] <= MAX ('Fiscal Year Conversion'[Calendar Date] )
)
),
BLANK ()
)

 

As for my LY DTD I am doing (just putting -1 after fy): 

LY DTD =
IF (
HASONEVALUE ( 'Fiscal Year Conversion'[Fiscal Year] ),
CALCULATE (
SUM ( 'Opportunity Tracker 2.0'[Annual Volume LBS] ),
FILTER (
ALL ( 'Fiscal Year Conversion' ),
'Fiscal Year Conversion'[Fiscal Year] = VALUES ('Fiscal Year Conversion'[Fiscal Year] ) -1
&& 'Fiscal Year Conversion'[Calendar Date] <= MAX ('Fiscal Year Conversion'[Calendar Date] )
)
),
BLANK ()
)
 
any suggestions?? It shouldn't even return until January 2nd of FY2020, as January 2nd of 2019 was my first date. 

Thanks!
2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @lennyt99 ;

Try it .

LY DTD =
IF (
    HASONEVALUE ( 'Fiscal Year Conversion'[Fiscal Year] ),
    CALCULATE (
        SUM ( 'Opportunity Tracker 2.0'[Annual Volume LBS] ),
        FILTER (
            ALL ( 'Fiscal Year Conversion' ),
            'Fiscal Year Conversion'[Fiscal Year]
                = MAX ( 'Fiscal Year Conversion'[Fiscal Year] ) - 1
                && 'Fiscal Year Conversion'[Calendar Date]
                    <= MAX ( 'Fiscal Year Conversion'[Calendar Date] )
        )
    ),
    BLANK ()
)

If the above one can't help you get the desired result, please provide some sample data in your tables (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. You can refer the following link to upload the file to the community. Thank you.

Solved: How to upload PBI in Community - Microsoft Power BI Community


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

daXtreme
Solution Sage
Solution Sage

If you want to calculate LY DTD, you first have to calculate the date range for DTD and then move this range one year back and apply this filter to the measure in question.

 

By the way, it's a DAX question, not Power Query, so technically you should have asked this question on a different forum.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors