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
Vallirajap
Resolver III
Resolver III

Selected Year as a filter value in a Trend

Hii All, 

I stucked with one scenario. 
I have a month slicer in MMM-YY format with single select. when i choose the slicer to get the respective whole year value in a monthly trend

For Example : When i select any months in the year 2024 (ex: Mar-24) means then all the values of year 2024 will return in a table like below

Vallirajap_0-1730966279882.png

Same like all the years based on the selected month.
Thanks in advance..!

 

1 ACCEPTED SOLUTION
v-xuxinyi-msft
Community Support
Community Support

Hi @Vallirajap 

 

Thanks for the reply from vojtechsima and Rupak_bi .

 

@Vallirajap , Do you need to display all values ​​of the same year as the selected content in the visualization chart based on the slicer? If so, the following test is for your reference:

 

My sample:

 

Calendar table:

vxuxinyimsft_0-1731051403700.png

 

Data table:

vxuxinyimsft_1-1731051424483.png

 

no relationship between two tables

vxuxinyimsft_2-1731051460056.png

 

Create a measure as follows

Measure = CALCULATE(SUM('Table'[Value]), YEAR('Table'[Date]) = YEAR(SELECTEDVALUE('Calendar'[Date])))

 

Output:

vxuxinyimsft_3-1731051696402.png

In my Line chart, the [Date] column is used as the x-axis, not the [Month] column.

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-xuxinyi-msft
Community Support
Community Support

Hi @Vallirajap 

 

Thanks for the reply from vojtechsima and Rupak_bi .

 

@Vallirajap , Do you need to display all values ​​of the same year as the selected content in the visualization chart based on the slicer? If so, the following test is for your reference:

 

My sample:

 

Calendar table:

vxuxinyimsft_0-1731051403700.png

 

Data table:

vxuxinyimsft_1-1731051424483.png

 

no relationship between two tables

vxuxinyimsft_2-1731051460056.png

 

Create a measure as follows

Measure = CALCULATE(SUM('Table'[Value]), YEAR('Table'[Date]) = YEAR(SELECTEDVALUE('Calendar'[Date])))

 

Output:

vxuxinyimsft_3-1731051696402.png

In my Line chart, the [Date] column is used as the x-axis, not the [Month] column.

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Rupak_bi
Post Prodigy
Post Prodigy

plz share sample data



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/
vojtechsima
Super User
Super User

Hello, @Vallirajap ,

this is not really easy, but you can try this:
twoCalendarSolution.pbix

essentially, you have 2 calendars:

vojtechsima_0-1730972956196.png

you write measure then like this:

sumSpecial = 
var year = YEAR( MAX(calendar_helper[Date]) )
var result = 
CALCULATE(
    [sum],
    year(calendar_helper[Date]) = year,
    USERELATIONSHIP(calendar_helper[Date], 'calendar'[Date])
)

return result

Your page looks like this;


Slicer is from Calendar_Helper, table has Date from regular Calendar

vojtechsima_1-1730972996955.png

 

Hi @vojtechsima

Thanks for the reply.
There are alternative methods available without the need for a third date table.
In our model, one calendar table and a fact table are there. We can't add another table because it affects our data model.

 

Can you please explain any other option to do the same? 

Thanks in advance.



 
 

Hi, @Vallirajap ,

there's alternative.

 

sumSpecial = 
var year = YEAR( MAX('calendar'[Date]) )
var result = 
CALCULATE(
    [sum],
    KEEPFILTERS(YEAR('Table'[date]) = year)
)
return result


Make Calendar -> Fact Table as Inactive relationship.
Slicer = Calendar,  table has only Fact table columns:


vojtechsima_0-1730974922567.png

 

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!

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.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.