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
Anonymous
Not applicable

Dynamic Date title for Drilldown

Hi guys

 

So I have a line graph with Date along the x axis and a sum of paid invoices along the Y. Simples. The graph uses a DimDate table and I have it as a heirarchy for drilldown.

I want the title of the graph to say "PAID INVOICES BY _" and I want it to say "DAY, MONTH, QUARTER, YEAR" respectively depending on what level of the heirarchy is selected. 

 

My failed attempt was the measure:

Title Paid Invoices by Treatment Period = "PAID INVOICES BY " & SELECTEDVALUE(DimDate[Date])
 
This measure just shows "PAID INVOICES BY" and the date part remains blank. 
HELP!
DynamicTitle.png
7 REPLIES 7
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

Sorry to disturb you...

But did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

Best Regards,
Eyelyn Qin

v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

For my test, the title will be changed automatically based on Hierarchy.

PAID INVOICES =
SUM ( 'Table2'[Values] )

9.21.3.1.gif

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.

If not, please upload some insensitive data samples and expected output.

 

Best Regards,

Eyelyn Qin

MFelix
Super User
Super User

Hi @Anonymous ,

 

Try the following code, be aware that the order of the arguments is very important.

 

var =
"PAID INVOICES BY:" &
SWITCH (
    TRUE ();
    DISTINCTCOUNT ( Date[Month] ) = 1; "Day";
    DISTINCTCOUNT ( Date[Quarter] ) = 1; "Month";
    DISTINCTCOUNT ( Date[Year] ) = 1; "Quarter";
    "Year"
)

 

Be aware that for this calcultion I have a Month, quarter and year column on my table.

 


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



Anonymous
Not applicable

@MFelix thanks, this is looking a little better, but my title now just says "YEAR" on every level.

My DimDate table has calculated columns for MONTH QUARTER and YEAR: 
Treatment Year =YEAR([Date])

Treatment Quarter =QUARTER([Date])
Treatment Month = FORMAT([Date],"mmm"

 

My measure looks like this:

Title Paid Invoices by Treatment Period =

"PAID INVOICES BY: " &
SWITCH(
TRUE(),
DISTINCTCOUNT(DimDate[Treatment Month]) = 1, "MONTH",
DISTINCTCOUNT('DimDate'[Treatment Quarter]) = 1, "QUARTER",
"YEAR")
 
If I use a slicer with Month Year or Quarter columns in it, the dynamic title starts working. But, I want it to work when you drilldown on the visual, not apply a slicer. 

Hi @Anonymous ,

 

As I refered the order is very important on the setup you are making this also if you check my formula I'm not picking up the current level for giving the title but the higher one, so for returning Month I'm checking if the quarter is only a single value.

 

Try the following code.

 

Title Paid Invoices by Treatment Period =

"PAID INVOICES BY: " &
SWITCH(
TRUE(),
DISTINCTCOUNT(DimDate[Treatment Month]) = 1, "Day",
DISTINCTCOUNT('DimDate'[Treatment Quarter]) = 1, "Month",
DISTINCTCOUNT('DimDate'[Treatment Year]) = 1, "Quarter",
"YEAR")

 


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



Anonymous
Not applicable

For some reason just doesn't work. Maybe because my date calendar is my month and year, with no day. Ah well I can just have a hard coded title it's not the end of the world! Thanks for helping 🙂

Hi @Anonymous ,

 

Can you share a mockup file? In my tests I was struggling with the setup that why I refered that you need to do it in a specif order.

 

 

 


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.