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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
NeilJustice
Frequent Visitor

Dynamic Title based on selected month values on slicer

I have a slicer that has Fiscal years, quarters and months for selection, i want to create a dynamic title for my other visual that when i select a month or multiple months, quarter or FY the title displays for example "for the Period  [selected month or months]" comma delimited. but if i dont select any it displays something like all selected. Or even better it displays the last relevant full calendar month, i.e so if we are in the middle of May 24, and i dont select any dates then my visual will default to showing the data for the last relevant month i.e April 24 and the title will display the relevant month. 

I have tried this numerous times, i have managed to get it to show either one or multiple selections but as soon as dont select any it returns all months within my date period, for example jan 23 -thru to 

7 REPLIES 7
DataNinja777
Super User
Super User

Hi @NeilJustice 

 

Does the below meet your requirement?  

DataNinja777_1-1714832350244.png

 

I attach the pbix file below.  

Hi @DataNinja777     Nearly. but this is what i get when nothing is selected 

NeilJustice_0-1714900560592.png

and this is what i get when i select month or months 

NeilJustice_1-1714900753634.png

I want it to show the last full calendar month from the point in time i am looking at report. when nothing is selected, is this possible? Thanks in advance 

ps is it because i am trying to add the dynamic subtitle visual, should it be on a seperate card as in yours?

Hi @NeilJustice 

 

You can create your dynamic title in your pie chart in the same manner, instead of creating a separate card visual.  

DataNinja777_0-1714905132772.png

I tweaked the formula a little bit, and you can flexibly change the output by tweaking if your required output is different.  I attach an example pbix file.  

Best regards,

 

Hi, 

I have replicated the above in my report, the month or months filter works fine but when i have nothing selected it now returns Sep24. and the pie chart, shows all values for the date period in my calendar.  The calendar is created from taking the min & max dates of "invoice creation date" in my main data table as in expression below 

Date Table Invoice creation date = CALENDAR(
DATE(YEAR(MIN('Table' [Invoice Creation Date])),1,1),
DATE(YEAR(MAX('Table' [Invoice Creation Date])),12,31)), and my expression i used to replicate yours is 
 
Monthbymonth view =
IF (
    DISTINCTCOUNT ( 'Date Table Invoice creation date'[FY Month No] ) = 12,
    calculate(if(hasonevalue('Date Table Invoice creation date'[Month Year] ),values('Date Table Invoice creation date'[Month Year] ),blank()),filter('Date Table Invoice creation date','Date Table Invoice creation date'[End of Month]=max('Date Table Invoice creation date'[End of Month]))),
    CONCATENATEX ( VALUES ( 'Date Table Invoice creation date'[Month Year]), 'Date Table Invoice creation date'[Month Year], ", " ), so not sure why its returning Sep 24 when nothing is selected in my slicer.
what i want it to show is the last relevant full calendar month and the correct values for that month in my pie chart.
e.g No dates selected in slicer, returns Apr 24 and its values, if it were todays date. if this is possible

Hi @NeilJustice 

The fact that your filter of the max of End of Month is showing as Sep-24 instead of Dec-24 is due to the fact that your month order is in alphabetical order instead of numerical order.  What is the data type of your  'Date Table Invoice creation date'[End of Month]?  It should be in a date format instead of text format.  

DataNinja777_0-1714916777691.png

Best regards,

 

Hi @DataNinja777 

This is now showing Dec 24 as you have stated above, so it works in that respect, but i dont want it to do that, i want it to show the previous full calendar month to what the current month is. So when nothing is selected, as of today i would expect to see the month for Apr 24 and this point in time next month (June) i would expect to see May 24 if nothing is selected. So the first part of the expression works fine, its just getting the second part to default to the previous month . cheers

Addition:- 

I have amended the expression so that it now shows the previous month if none of the values in the slicer are selected. But it doesnt filter the values in the visual to show that month, It shows the totals for all the dates, i am guessing that this is because the visual is theoretically not being filtered, only the visual title. It only filters when i select a date in my slicer, how would we amend this to actually show the correct values when filtered. 

The amended expression is 

Month title = IF (
    DISTINCTCOUNT ( 'Date Table Invoice creation date'[FY Month No] ) = 12,
    CALCULATE(IF(HASONEVALUE('Date Table Invoice creation date'[Month Year] ),VALUES('Date Table Invoice creation date'[Month Year] ),FORMAT(EOMONTH(TODAY(), -1), "mmm - yy"))),
    CONCATENATEX ( VALUES ( 'Date Table Invoice creation date'[Month Year]), 'Date Table Invoice creation date'[Month Year], ", " ))
 
Greg_Deckler
Super User
Super User

@NeilJustice The Most Amazing, Mind Blowing Dynamic Slicer Titl... - Microsoft Fabric Community

 

Otherwise, Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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