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
ak77
Post Patron
Post Patron

Fiscal Year Calculation`

Hi All,

 

Thanks much  for helping out till date !..

 

I need help on the below requirement where we have to display fiscal year sum of returns for multiple clients in a measure.. til now i had clients which had year end date 31/03 and i was using below measure 

FYTD =CALCULATE([Total ReturnV1],DATESYTD('Date Table'[_Date],"31/03"))
 
Now i am getting the year end date in a separate table as below and user expects to use the year end date from the table in the measure.  i tried replacing the hardcoded value (31/03) with the column YearEnd .. but its not allowing me to do so and the option of selecting this column is not available to use..  Can anyone please help on this 
 
ak77_0-1694061444979.png

 

 
1 ACCEPTED SOLUTION

you can also use this measure to get the same data

Sales YTD = 
VAR __SUM = CALCULATE (
    [Amo],
    VAR FirstFiscalMonth = [StartFY] -- Set the first month of the fiscal year
    VAR LastDay =
        MAX ( 'Calendar'[Date] )
    VAR LastMonth =
        MONTH ( LastDay )
    VAR LastYear =
        YEAR ( LastDay )
            - IF ( LastMonth < FirstFiscalMonth, 1 )
    VAR FilterYtd =
        DATESBETWEEN (
            'Calendar'[Date],
            DATE ( LastYear, FirstFiscalMonth, 1 ),
            LastDay 
        )
      
    RETURN
   FilterYtd)
   VAR _MaxdareSales = MAX('Sales'[Business Days])
   RETURN
   IF(_MaxdareSales,__SUM)

View solution in original post

8 REPLIES 8
Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

https://1drv.ms/u/s!AiUZ0Ws7G26RikbVQdUS5C2JC-Ho?e=xqio2U

you can also use this measure to get the same data

Sales YTD = 
VAR __SUM = CALCULATE (
    [Amo],
    VAR FirstFiscalMonth = [StartFY] -- Set the first month of the fiscal year
    VAR LastDay =
        MAX ( 'Calendar'[Date] )
    VAR LastMonth =
        MONTH ( LastDay )
    VAR LastYear =
        YEAR ( LastDay )
            - IF ( LastMonth < FirstFiscalMonth, 1 )
    VAR FilterYtd =
        DATESBETWEEN (
            'Calendar'[Date],
            DATE ( LastYear, FirstFiscalMonth, 1 ),
            LastDay 
        )
      
    RETURN
   FilterYtd)
   VAR _MaxdareSales = MAX('Sales'[Business Days])
   RETURN
   IF(_MaxdareSales,__SUM)
Ritaf1983
Super User
Super User

Hi @ak77 
You can use some conditions like :
If (month(max('yourtable[yearend]))= 3,
FYTD =CALCULATE([Total ReturnV1],DATESYTD('Date Table'[_Date],"31/03")),
FYTD =CALCULATE([Total ReturnV1],DATESYTD('Date Table'[_Date],"31/12"))
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

@Ritaf1983 , thanks for reply.. can i use FYTD =CALCULATE([Total ReturnV1],DATESYTD('Date Table'[_Date],yourtable[yearend]) the year field as the parameter to the function? 

Hi @ak77 
The suggested way is not correct for sure because 'yourtable[yearend]' is a column and not a scalar value, so you can't filter by it ( because the column is a multiple values and not one).
You can try to modify it to :
FYTD =CALCULATE([Total ReturnV1],DATESYTD('Date Table'[_Date],max(yourtable[yearend])
just try, there is no way a computer can defeat you 🙂

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

No Luck ! Sorry 

What is wrong with my first suggestion?
For a more detailed solution please share some dummy PBIX to work with.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

The user does not want the date to be hardcoded FYTD =CALCULATE([Total ReturnV1],DATESYTD('Date Table'[_Date],"31/03")),

 

He wants it to be taken from a column name  coming from DB Table..  so if these value changes .. they can just update it in the DB column without any report changes 

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.