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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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