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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Madhu155154
Helper I
Helper I

Not able get last year complete number for current financial year

Hi Every  I am trying to get the previous  Year running total for the next fiscal year.

However I am not able to get it for the current fiscal year.


Madhu155154_0-1719846036759.png

 



The formula I used:

=VAR _date=

MAXX(

    SAMEPERIODLASTYEAR(DATESYTD(

   'Calendar'[Date]

        )),

    'Calendar'[Date]

)

 

RETURN

CALCULATE (

    [Total_Employee Count ],

    FILTER (

        ALL('Calendar'),

        'Calendar'[Date] <= _date

    )

1 ACCEPTED SOLUTION

Thank you @Rakesh1705 ,i was  your video it was good  but my requirement was different,  from the below, code, i was able to achieve the result 


CALCULATE (
[Running_Total_Employees],
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Fiscal Year] <MAX ( 'Calendar'[Fiscal Year] )
    )
)

View solution in original post

7 REPLIES 7
Rakesh1705
Super User
Super User

Hi I guess I have solved as per your requirement. Pls check the below snap.

Rakesh1705_0-1719935485816.png

For detail pls check the full video from the link below
Previous Year Running Total 

Thank you @Rakesh1705 ,i was  your video it was good  but my requirement was different,  from the below, code, i was able to achieve the result 


CALCULATE (
[Running_Total_Employees],
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Fiscal Year] <MAX ( 'Calendar'[Fiscal Year] )
    )
)

Anonymous
Not applicable

Hi all,Thank you for your quick reply, I will add more.

Hi @Madhu155154 ,

The Table data is shown below:

vzhouwenmsft_0-1719902629928.png

Please follow these steps:

1.Use the following DAX expression to create a date table.

 

 

 

Calendar = 
VAR _table = CALENDAR(DATE(2022,1,1),DATE(2024,12,31))
RETURN 
ADDCOLUMNS(_table,
"Column",
    SWITCH(TRUE(),
    YEAR([Date]) = 2022,"2022-2023",
    YEAR([Date]) = 2023,"2023-2024",
    YEAR([Date]) = 2024,"2024-2025"
    ),
"Month",
    SWITCH(TRUE(),
    MONTH([Date]) = 1 ,"Jan",
    MONTH([Date]) = 2 ,"Feb",
    MONTH([Date]) = 3 ,"Mar",
    MONTH([Date]) = 4 ,"Apr",
    MONTH([Date]) = 5 ,"May",
    MONTH([Date]) = 6 ,"Jun",
    MONTH([Date]) = 7 ,"Jul",
    MONTH([Date]) = 8 ,"Aug",
    MONTH([Date]) = 9 ,"Sep",
    MONTH([Date]) = 10 ,"Oct",
    MONTH([Date]) = 11 ,"Nov",
    MONTH([Date]) = 12 ,"Dec"
    )
)

 

vzhouwenmsft_0-1719909357769.png

vzhouwenmsft_1-1719909382681.png

2.Use the following DAX expression to create measures.

 

_Value = SUM('Table'[Value])
Prev_Year_Value = CALCULATE([_Value],SAMEPERIODLASTYEAR('Calendar'[Date]))

 

3.Final output

vzhouwenmsft_2-1719909422569.png

vzhouwenmsft_3-1719909469136.png

 

 

If I understand wrongly, please share simple data.

 

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

Thank you @Anonymous , i was able achieve my result by below code. 


CALCULATE (
[Running_Total_Employees],
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Fiscal Year] <MAX ( 'Calendar'[Fiscal Year] )
    )
)

Rakesh1705
Super User
Super User

Rakesh1705_0-1719851422565.png

Source Data

Rakesh1705_1-1719851470440.png

Calculating Prev FY column

Rakesh1705_2-1719851932350.png

Calculating Prev FY Value

Rakesh1705_3-1719852003576.png

Calculating Current FY running total

Rakesh1705_4-1719852049764.png

Calculating Prev FY running total

Rakesh1705_7-1719852200087.png

Creating FY Table

Rakesh1705_8-1719852228892.png

Creating relationship between FY[FY] and table[FY]

Rakesh1705_9-1719852288826.png

Required table is ready.

 



@Rakesh1705 , Thank you for replying, the issue is, i  have further granularity of months.

if you see below pic,  for cureent year, i have months till october, 

Madhu155154_0-1719883305547.png



Because of that, it is taking previous year data  till october, showing it for  current year. 


But what i want is, to ignore the  month's,  show me entire value of last year to current year 


Madhu155154_1-1719883649945.png

i want 186 instead of 145

Greg_Deckler
Super User
Super User

@Madhu155154 You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.