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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
millec
New Member

How to shift dates (years) based on a filter

I have a table with a date column and I would like the user to be able to select fiscal year's start month. Based on the user filter selection, the table (which includes the dates) would assign the appropriate fiscal years.

 

For example, a table with dates and counts:

DateCount
1/1/20214
2/15/20215
3/20/20216
4/1/20212
5/10/20214
6/30/20215

 

And a table of months index, used as the filter:

Month Index
1
2
3
4
5
...

 

If the user filtered on "1" (January), then that would indicate a normal calendar year and all the rows in the above example would belong to year = 2021. If the user selected "3" (March), indicating they wanted the fiscal year to begin March 1, then the first two rows in the above example should be assigned year = 2020 and all other rows would be year = 2021.

 

Ultimately, I would like a bar chart that adjusts with the users selection and has year on the x-axis and count on the y-axis. Can this be done?

2 REPLIES 2
bhelou
Responsive Resident
Responsive Resident

Hello , 

is it possible to share some data sample ? , 

to create a dynamic measure you should do the following for the fiscal year : 

1 : create a column in the table you have with this measure : 

if(month(table[date])<[star month],year(table1[date])-1,year(table1[date])) +
if(moht(table1[date])>=[start month],1,0)

////// 

then to have this work make a parameters in the modeling tab : 

new parameter  :  as per the image attached : 

Nem : Start Month , Type whole Number , Min 1 , MAX 12 , leave it as default ( 1 ) as for January . 1111111.png


Then , when bar chart is created you can youse fiscal year calculated column as the x axis and the count column as the y axis , the user can adjust the start month and the chart will be updated dynamiclly bas on the selection . 

Kindly accept as a solution if it works with you and a kudo would be appreciated . 

Regards , 


I can't make a column dynamic and respond to a changing parameter. The column stays fixed at the parameter default value. Am I missing something?

millec_0-1679495424858.png

 

See below. As it is, the data plots like the upper-right chart. When the slicer is at 3, I want the chart to look like the lower-right chart. How can I make a dynamic chart that does this?

 

millec_1-1679495497226.png

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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