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

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.

Reply
DebbieE
Community Champion
Community Champion

Change Title to Slicer if Slicer is used

Hi all,

 

i have a Column in my dim table containing a header for a table. So I show this over a visual

 

BUT if the user chooses the year and Month from the date Slicer I want it to show this instead

 

The example is that the title normally says

 

Dates from 2020 through to 2024

 

As soon as the user slices for example 1 year. I want it to say 2023

If a user Slices a year and some months in that year I want it to say 2023 March April

If a user slices multiple things I want it to say 2023 March April 2024 January

 

Or something along those lines.

 

Is this possible at all?

5 REPLIES 5
MFelix
Super User
Super User

Hi @DebbieE ,

 

For this you need to make a measure that you will use dinamically on your title.

 

Check this video from Guy in the Cube with Alberto Ferrari

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



DebbieE
Community Champion
Community Champion

This is great but it only does months,. It doesnt do months and years and its already really complex. I dont know how to add in years to the mix?

 

And then the next step for this question is how to show something else. unless the Years / Months are selected?

Hi Debbie,

 

I did this formula:

 

Date Information = VAR _maximumdate = MAX('Query1'[Date])
	VAR _minimumdate = MIN('Query1'[Date])
	VAR _nmonths = COUNTROWS(DISTINCT('Query1'[Year Month]))
	VAR _nyears = COUNTROWS(DISTINCT('Query1'[Year]))
	VAR _ntotalrows = COUNTROWS('Query1')
	VAR _nrowsselected = CALCULATE(
		COUNTROWS('Query1'),
		DATESBETWEEN(
			'Query1'[Date],
			_minimumdate,
			_maximumdate
		),
		REMOVEFILTERS('Query1')
	)
	RETURN
		SWITCH(
			TRUE(),
			_nyears = 1 && _nmonths = 12, FORMAT(
				_maximumdate,
				"YYYY"
			),
			_nyears = 1 && _nmonths < 12, MAX('Query1'[Year]) & ": " & CONCATENATEX(
				DISTINCT('Query1'[End of Month]),
				FORMAT(
					'Query1'[End of Month],
					"MMMM"
				),
				", "
			),
			_nmonths = 1, MIN('Query1'[Year Month]),
			_nrowsselected = _ntotalrows, FORMAT(
				_minimumdate,
				"YYYY MMMM"
			) & " to " & FORMAT(
				_maximumdate,
				"YYYY MMMM"
			),
			CONCATENATEX(
				SUMMARIZE(
					'Query1',
					'Query1'[Year],
					"D", CONCATENATEX(
						SUMMARIZE(
							'Query1',
							'Query1'[End of Month]
						),
						FORMAT(
							'Query1'[End of Month],
							"MMMM"
						),
						", "
					)
				),
				" " & 'Query1'[Year] & ": " & [D],
				UNICHAR(10)
			)
		)

 

MFelix_0-1708083627926.png

 

MFelix_1-1708083638095.png

 

MFelix_2-1708083668293.png

 

MFelix_3-1708083688444.png

 

 

Check the result in the PBIX attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



DebbieE
Community Champion
Community Champion

Apologies I have been on Annual leave. Thank you so much for this. However I can already see that this is way to complex for me to achieve in the time i have got.

 

Im a little confused by End of Month since its not something I have. Would I have to create this in the date dimension as an actual item?

This needs to be a complex formula based on the selected values, you can use the concatanex to make the formula. 

 

I will try to setup an example


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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