Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi Guys,
I have this visual, and I want to display selected year and selected year - 1 data only.
Selected Year = academic_year selected from the Filter Pane. I'm not using slicers because those dropdown will be outside of BI Report.
Solved! Go to Solution.
Hello again @lovishsood1 ,
I appreciate your follow-up.
Since you’re working exclusively with the Year column and don’t have a full date table, there’s no need for time-intelligence functions. You can achieve your goal efficiently with a straightforward DAX filter, like this:
ShowTwoYearsData =
VAR SelectedYear = SELECTEDVALUE('AcademicData'[Year])
RETURN
CALCULATE(
[YourMetric],
FILTER(
'AcademicData',
'AcademicData'[Year] IN { SelectedYear, SelectedYear - 1 }
)
)
This measure will accurately return results for the selected year and the previous year. You can use it directly in your visual, and it will function correctly even without a date table.
If you decide to expand to months or quarters in the future, implementing a proper Date table will be beneficial. For now, this year-based approach is the most effective solution for your requirements.
Thak you.
Hi @lovishsood1 ,
Thank you @Shahid12523 for the response provided!
Has your issue been resolved? If the response provided by the community member addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.
Thank you for your understanding!
Hi @lovishsood1 ,
I wanted to follow up and see if you had a chance to review the information shared. If you have any further questions or need additional assistance, feel free to reach out.
Thank you.
Tejaswi.
Hi, No its not resolved because I don't have date table in my model and only YEAR COLUMN.
Hello again @lovishsood1 ,
I appreciate your follow-up.
Since you’re working exclusively with the Year column and don’t have a full date table, there’s no need for time-intelligence functions. You can achieve your goal efficiently with a straightforward DAX filter, like this:
ShowTwoYearsData =
VAR SelectedYear = SELECTEDVALUE('AcademicData'[Year])
RETURN
CALCULATE(
[YourMetric],
FILTER(
'AcademicData',
'AcademicData'[Year] IN { SelectedYear, SelectedYear - 1 }
)
)
This measure will accurately return results for the selected year and the previous year. You can use it directly in your visual, and it will function correctly even without a date table.
If you decide to expand to months or quarters in the future, implementing a proper Date table will be beneficial. For now, this year-based approach is the most effective solution for your requirements.
Thak you.
Hi @lovishsood1 ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Thank you,
Tejaswi.
Hii, can you help me with the below query of year
Can you tell me How to make a year measure which shoudl have condition like even if the data doest not have value for all month like all 12 month then also the whole 12 month ka value should show by taking some of the month from previous year to complete the 12 month sereies with cureent year.
FOR eg: for year 2025 my data has the value only for three month like jan,feb and march. and year 2024 have all jan to dec okay
so in my matric visual i want the result to shown as
apr-24 may -24, jun-24, july-24 ......nov-24, dec-24, jan-25, feb-25,mar-25
I hope from the above kidn of example you get my question, so it should be like that much dynmich thta if 2025 get any new month added to data then accoridng it should show from prevoiud year till current year by considering of 12 month series
You can use the Filter Pane - Drag the Date column and set it to Last 12 months
Goal: Show data for Selected Year and Selected Year - 1.
DAX Measure:
ShowTwoYearsData =
VAR Selected = SELECTEDVALUE(SelectedYearTable[Year])
RETURN
CALCULATE(
[YourMetric],
FILTER(
'AcademicData',
'AcademicData'[Year] IN {Selected, Selected - 1}
)
)
Use this measure in your visual to filter the data dynamically. Let me know if you want to plug in a specific metric or refine it for stacked visuals.
You can adapt the technique described in https://www.sqlbi.com/articles/show-previous-6-months-of-data-from-single-slicer-selection/ to show 2 years instead of 6 months.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 97 | |
| 74 | |
| 50 | |
| 47 | |
| 44 |