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
Vinothsusai
Helper III
Helper III

Sum of Amount by previous Fiscal year and current Fiscal year

Hi,

I have a table below. My previous fiscal year starts at 1/7/2018(July) to 30/6/2019 and current fiscal year starts at 1/7/2019(July) to 30/6/2020.

Date              Amount

6/1/2018300
7/1/2018100
7/10/2018100
8/5/2018100
9/11/2018200
12/12/2018200
1/1/2019100
2/13/2019500
3/14/2019800
5/18/2019900
6/20/2019100
7/22/2019200
8/13/2019100
9/11/2019199
12/12/2019200

 

I want to create a measure for previous fiscal year that has to be sum only previous fiscal year records like below

Date              Amount

6/1/2018300
7/1/2018100
7/10/2018100
8/5/2018100
9/11/2018200
12/12/2018200
1/1/2019100
2/13/2019500
3/14/2019800
5/18/2019900
6/20/2019100

 

Total  =   3400

 

For current fiscal year that has to be sum only current fiscal year records

Date              Amount

7/22/2019200
8/13/2019100
9/11/2019199
12/12/2019200

 

Total = 699

 

Could you please advise.

 

Thanks

Vinoth SUSAINATHAN

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi Vinoth - 

 

You can try the following measures in your table (assuming the fiscal year values are hardcoded and will not change)

For previous fiscal year:
"

prevFiscalYearTotal =

VAR fiscalYearStart = DATE(2018,7,1)

VAR fiscalYearEnd = DATE(2019,6,30)

RETURN
CALCULATE(
SUM('TableName'[Amount]),
FILTER(
'TableName',
'TableName'[DateAmount] >= fiscalYearStart &&
'TableName'[DateAmount] <= fiscalYearEnd
)
)


"

And for the current year you can change the date values in the variable above.

If the above helped you, please select this as solution.

Regards

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi Vinoth - 

 

You can try the following measures in your table (assuming the fiscal year values are hardcoded and will not change)

For previous fiscal year:
"

prevFiscalYearTotal =

VAR fiscalYearStart = DATE(2018,7,1)

VAR fiscalYearEnd = DATE(2019,6,30)

RETURN
CALCULATE(
SUM('TableName'[Amount]),
FILTER(
'TableName',
'TableName'[DateAmount] >= fiscalYearStart &&
'TableName'[DateAmount] <= fiscalYearEnd
)
)


"

And for the current year you can change the date values in the variable above.

If the above helped you, please select this as solution.

Regards

Hi,

Thank you very much for your reply. The date values should not be hard coded values. This has to be dynamically calculates the current and previous fiscal year. Could you please advise.

 

 

Thanks

Vinoth S

Hi,

It works great. I just replaced the datavalues as Year(Today()) -1 for previous fiscal year.

 

prevFiscalYearTotal =

VAR fiscalYearStart = DATE(YEAR(TODAY())-1,7,1)

VAR fiscalYearEnd = DATE(YEAR(TODAY()),6,30)

RETURN
CALCULATE(
SUM('Amount calculation'[Amount]),
FILTER(
'Amount calculation',
'Amount calculation'[Date] >= fiscalYearStart &&
'Amount calculation'[Date] <= fiscalYearEnd
)
)
 
Thank you
 
 
Vinoth SUSAINATHAN
 
Anonymous
Not applicable

Awesome, thanks much for that point you mentioned, and thanks for accepting the solution.

 

All the best.

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.