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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
MaliniBaktha
Helper II
Helper II

Need help Calculate Prior year values working for one other filter

Hi , 

I am working on the data where I am calculating the sum of appointments total by prior fiscal year.  to calculate the prior year values , I have used a calculation suggested by this forum, it works fine  when we select year filter, but the moment I select other filter this calculation prior year calculation doesnot hold good. 

How do I correct it ?

 

This is the calculation I am using to calculate previous year 

calculate(sum('OLD ONE'[COUNT(DISTINCT APT)]),filter(ALL('OLD ONE'),[FISCAL_YEAR_NUM]=SELECTEDVALUE('OLD ONE'[FISCAL_YEAR_NUM])-1))
 
Now I want this calcualtion to work for other region level filter too . the moment I chose a region filter the prior year filter is not working 
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I assume your datamodel does not have calendar dimension table or region dimension table.

One of the best ways is to have those dimension tables, but in case you cannot create those, please try something like below.

 

expected previous year =
CALCULATE (
    SUM ( 'OLD ONE'[COUNT(DISTINCT APT)] ),
    VALUES ( 'OLD ONE'[Region Name] ),
    FILTER (
        ALL ( 'OLD ONE' ),
        [FISCAL_YEAR_NUM]
            = SELECTEDVALUE ( 'OLD ONE'[FISCAL_YEAR_NUM] ) - 1
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Rakesh1705_0-1719826707303.png

Source Data

Rakesh1705_1-1719826747772.png

Previous Year Formula

Rakesh1705_2-1719826781284.png

Result when nothing is selected

Rakesh1705_3-1719826832074.png

Result when 2024 is selected. Please check the prior snapshot for the result of 2023 in the matrix table.

Rakesh1705_4-1719826884054.png

Business Development is selected from Department Slicer.

One more thing before doing the measure I had created the year column from the date column.

Please let me know if the same formula is applicable for your dataset or not.



Jihwan_Kim
Super User
Super User

Hi,

I assume your datamodel does not have calendar dimension table or region dimension table.

One of the best ways is to have those dimension tables, but in case you cannot create those, please try something like below.

 

expected previous year =
CALCULATE (
    SUM ( 'OLD ONE'[COUNT(DISTINCT APT)] ),
    VALUES ( 'OLD ONE'[Region Name] ),
    FILTER (
        ALL ( 'OLD ONE' ),
        [FISCAL_YEAR_NUM]
            = SELECTEDVALUE ( 'OLD ONE'[FISCAL_YEAR_NUM] ) - 1
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.