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
DaniloCastro
Frequent Visitor

Last Fiscal Year Total by Month - DAX

Hi,

I have tried to create one DAX expression to calculate the total amount of one column based on the fiscal year. The report will show the comparison between the current fiscal year and the previous one, by month.

 

Following there are the two DAX expressions I have used to create the total calculation based on fiscal year, and the motive of why they are not working:

  1. CALCULATE (
        SUM ( Customer[Income] ),
        SAMEPERIODLASTYEAR ( DATESYTD ( DimDate[FullDate], "06-01" ) ),
        ALL ( DimDate )
    )    ERROR: The total of last fiscal year is summarized month by month rather than show only the total of that specific month.
  2. CALCULATE (
        SUM ( Customer[Income] ),
        FILTER (
            ALL ( DimDate),
            DimDate[FiscalMonthOfYear] = MAX ( DimDate[FiscalMonthOfYear] )
                && DimDate[FiscalYear]
                    = MAX ( DimDate[FiscalYear] ) - 1
        )
    )   ERROR: This expression is showing the correct total for each month, however on Total Columns it is showing the total of the last fiscal month rather than the sum of all displayed months.

Has anyone ever faced this situation before, please?

 

Thanks in advance for your help!

 

Danilo Castro

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

@DaniloCastro,

 

It seems that you can use SAMEPERIODLASTYEAR Function directly.

SAMEPERIODLASTYEAR ( DimDate[FullDate] )
Community Support Team _ Sam Zha
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

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@DaniloCastro,

 

It seems that you can use SAMEPERIODLASTYEAR Function directly.

SAMEPERIODLASTYEAR ( DimDate[FullDate] )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft,

 

Exactly! Changing the measure, the first one I've sent on my initial post, to use directly SAMEPERIODLASTYEAR works.

 

Solution:

CALCULATE (
    SUM ( Customer[Income] ),
    SAMEPERIODLASTYEAR (DimDate[FullDate]),
    ALL ( DimDate )

 

Thank you very much for your help!

 

Danilo Castro

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.