Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Greetings Power BI ninjas! I am a new Power BI user and need some assistance from the community. I am trying to create a custom date range that will go back 15 years from the date that I manually select.
Target result: I want to have a drop down selection where I pick a year, the selected year will calculate back the selected year + 15 years prior.
Current problem: The closest thing that I can get to this is a sliding date scale but my ultimate target is to just have a drop down where I can select a year and it will calculate that selected year + 15 years prior just like what the sliding date scale is accomplishing (please see screenshot below for reference)
As a new user, I am a true noob and welcome any advise. Please be advised that as a true noob, your welcomed advice might literally have to be spelled out in steps for me.
Help a brotha out pls!
Solved! Go to Solution.
Hi @Anonymous,
You can create an extra table which is unrelated to source data table, to list all available year selections.
Year selection = FILTER ( CALENDAR ( DATE ( 1980, 1, 1 ), DATE ( 2020, 1, 1 ) ), MONTH ( [Date] ) = 1 && DAY ( [Date] ) = 1 )
Later, please add this [date] field into slicer.
Create below measure and add it to visual level filter, set its value to 1.
flag = IF ( MAX ( 'Sheet1 (2)'[Year] ) <= YEAR ( SELECTEDVALUE ( 'Year selection'[Date] ) ) && MAX ( 'Sheet1 (2)'[Year] ) > YEAR ( SELECTEDVALUE ( 'Year selection'[Date] ) ) - 15, 1, 0 )
Best regards,
Yuliana Gu
Hi @Anonymous,
You can create an extra table which is unrelated to source data table, to list all available year selections.
Year selection = FILTER ( CALENDAR ( DATE ( 1980, 1, 1 ), DATE ( 2020, 1, 1 ) ), MONTH ( [Date] ) = 1 && DAY ( [Date] ) = 1 )
Later, please add this [date] field into slicer.
Create below measure and add it to visual level filter, set its value to 1.
flag = IF ( MAX ( 'Sheet1 (2)'[Year] ) <= YEAR ( SELECTEDVALUE ( 'Year selection'[Date] ) ) && MAX ( 'Sheet1 (2)'[Year] ) > YEAR ( SELECTEDVALUE ( 'Year selection'[Date] ) ) - 15, 1, 0 )
Best regards,
Yuliana Gu
Thank you so much!
Welcome to the Power BI dojo @Anonymous 🙂
There are probably several approachea, I think this solution should fit your need alright.
You can have a new calculated table with two columns:
- "Year anchor" that will be your slicer
- "Year", that will have a relationship to your date table or whatnot
This formula will generate a table where each year anchor will have 15 rows (year -15 up to year anchor)
Table =
FILTER(
CROSSJOIN(
SELECTCOLUMNS(GENERATESERIES(2000,2015,1),"YearAnchor",[Value]),
SELECTCOLUMNS(GENERATESERIES(1985,2015,1),"Year",[Value])
), AND([Year] >= ([YearAnchor] - 15), [Year] <= [YearAnchor])
)
Hope this helps!
Arentir
thank you so much!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
100 | |
78 | |
75 | |
50 |
User | Count |
---|---|
144 | |
109 | |
108 | |
88 | |
61 |