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
admin11
Memorable Member
Memorable Member

YTD expression less one month

Hi All

 

I have below expression working fine :-

_YTD REV = CALCULATE(CALCULATE(GL[AMOUNT],DATESYTD('Date'[Date],"12/31")), GL[1_REV] = "REV")
 
Due to GL report alway delay , so i like to modify the above expression one month less. For example now is 1-30 march , the expression will compute YTD from 1 jan till 30 Feb and not 1 jan till 30 march.
 
Hope some one can advise.
 
Paul 
 
1 ACCEPTED SOLUTION

Hi @admin11 

YTD Less one Month column is a Flag, please try to build it in your Date table.

In your sample , you build it in another table instead of Date table, so you will get the wrong result.

You table should look like as below. YTD Less one Month column in Jan and Feb in 2021 will return 1 and Mar will return 0.

3.png

Result is as below.

By default:

5.png

Select 1, it will show Jan and Feb in 2021.

4.png

 

Best Regards,

Rico Zhou

 

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

4 REPLIES 4
v-rzhou-msft
Community Support
Community Support

Hi @admin11 

I think you want to show values less one month due to report delay.

Try to build a calculated column for filter

 

YTD Less one Month =
IF (
    YEAR ( 'Table'[Date] ) = YEAR ( MAX ( 'Table'[Date] ) )
        && MONTH ( 'Table'[Date] )
            <= MONTH ( MAX ( 'Table'[Date] ) ) - 1,
    1,
    0
)

 

1.png

Then you can use [YTD Less one Month] = 1 in filter to filter the YTD expression less one month.

If this reply still couldn't help you solve your problem, please show me a sample by your Onedrive for Business.

And you can show me a screenshot of the result you want to me.

 

Best Regards,

Rico Zhou

 

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

 

 

@v-rzhou-msft 

I have try , i get Jan till DEc 2021. what i expect is getting only Jan till Feb 2021 not include March 2021.

admin11_0-1615117336827.png

 

Hi @admin11 

YTD Less one Month column is a Flag, please try to build it in your Date table.

In your sample , you build it in another table instead of Date table, so you will get the wrong result.

You table should look like as below. YTD Less one Month column in Jan and Feb in 2021 will return 1 and Mar will return 0.

3.png

Result is as below.

By default:

5.png

Select 1, it will show Jan and Feb in 2021.

4.png

 

Best Regards,

Rico Zhou

 

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

amitchandak
Super User
Super User

@admin11 ,

Try like

 

YTD QTY forced=
var _max = eomonth(today(),-1)
return
if(max('Date'[Date])<=_max, calculate(Sum('order'[Qty]),DATESYTD('Date'[Date])), blank())
//or
//calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),filter('Date','Date'[Date]<=_max))
//calculate(TOTALYTD(Sum('order'[Qty]),'Date'[Date]),filter('Date','Date'[Date]<=_max))

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

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!

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.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.