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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
SIGIPowerBI
New Member

Previous financial year based on slicer

Hello Power BI Community!

 

I have a very simple query that is causing me quite the headache. 

 

Basically, what I am trying to achieve is to have a slicer on the page which shows fiancal year and a card visual that displays the sum of the values for the previous year based on which year the user has selected in the slicer. 

 

My current data model looks like this and the idea is to have multiple tables which connect to the Calendar one:

Tables:

  - Table 

Period Margin Product

202120210A
2022121392A
2023123142A
20212141A
20221351A
202312341A
20211214B
202212414B
20235142B

 

 - Calendar 

Financial Year

2021
2022
2023

 

They are connected via a one-to-many relationship with a single filter direction going from Calendar to Table.

 

When I use this formula + a slicer for Period from the Table table it is working:

 

Measure =
 var previousPeriod =
      SELECTEDVALUE(
           'Table'[Period]
      ) - 1
 return
       CALCULATE(
            SUM(
             'Table'[Margin]
       ),
       'Table'[Period] = previousPeriod
  )
 
But what I need is to use the Calendar Financial Year to be able to slice the visual for previous period. When I use the same formula but with Calendar table Financial Year it is giving me BLANK:
 
New =
 var previousPeriod =
      SELECTEDVALUE(
          'Calendar'[Financial Year]
      ) - 1
 return
       CALCULATE(
            SUM(
             'Table'[Margin]
       ),
       'Table'[Period] = previousPeriod
  )
 
Any help would be appreciated. Thank you!
1 REPLY 1
Ankur04
Resolver II
Resolver II

Hi,

 

for this kind of scenario, I would suggest you to create a new column in your date table for as NewYear = Year + 1,

then use this Newyear in your Slicer. It should work. 

 

Note: the above solution is provided based on the requirement considering there is only one visual and Year as slicer.

 

let me know if this works.

 

 

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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