Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Dear all,
my datetable go from 2012 to 2030.
All the analysis are based on last 3 years (2021-2020-2019).
I'd like to build a model where people should not select the period (for example next year they need to set 2022-2021-2020).
I thought to build another timetable only for these analysis.
For this year 2021 = it start from 01.01.2019 - to 31.12.2021,
automatically on 01.01.2021 it should change in 01.01.2020 to 31.12.2022.
How can I do that?
In your opinion it could be an efficient solution or there are other better ways to manage this issue?
Thank in advance
Paolo
Solved! Go to Solution.
Hi @paolomint ,
Don't know how you have your timetable setup and if it's DAX or M language, however and depending on the way you want to do have the data you can do it in several manners.
Analisys Date = IF( Year(Calendar[Date]) >= Year(Today) - 2 && Year(Calendar[Date]) <= Year(Today) ), 1)
DAX CALENDAR TABLE=
FILTER (
CALENDAR ( "01/01/2012", "31/12/2025" ),
YEAR ( [Date] )
>= YEAR ( TODAY () ) - 2
&& YEAR ( [Date] ) <= YEAR ( TODAY () )
)
The filter expression should wrap your calendar syntax
If on the query editor go to your date column and add a filter with the following syntax:
= Table.SelectRows(#"Changed Type2", each Date.IsInPreviousNYears([Date], 2) or Date.IsInCurrentYear([Date]))
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em Portuguêshow do you currently create your table? you can probably filter out dynamically the dates you dont want, or if you are pulling from sql just write a dynamic query.
In your text filters in power query it should allow you to do relative filtering. But maybe if you can explain a little more on how you are creating this table currently where is the source?
Proud to be a Super User!
Hi @paolomint ,
Don't know how you have your timetable setup and if it's DAX or M language, however and depending on the way you want to do have the data you can do it in several manners.
Analisys Date = IF( Year(Calendar[Date]) >= Year(Today) - 2 && Year(Calendar[Date]) <= Year(Today) ), 1)
DAX CALENDAR TABLE=
FILTER (
CALENDAR ( "01/01/2012", "31/12/2025" ),
YEAR ( [Date] )
>= YEAR ( TODAY () ) - 2
&& YEAR ( [Date] ) <= YEAR ( TODAY () )
)
The filter expression should wrap your calendar syntax
If on the query editor go to your date column and add a filter with the following syntax:
= Table.SelectRows(#"Changed Type2", each Date.IsInPreviousNYears([Date], 2) or Date.IsInCurrentYear([Date]))
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsIf you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 46 | |
| 43 | |
| 39 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 65 | |
| 31 | |
| 28 | |
| 24 |