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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
HamidBee
Power Participant
Power Participant

How do I create a Dynamic Report Title for the possible scenarios?

I am working with the following data:

AreaValues
A45
B34
C87
D56
E97
F34
G21

 

I have plotted a simple bar chart to illustrate this data. I would like to have a dynamic title that does the following:

1) If none of the bars are selected it simply reads: "Total Number of Transactions".

 

2) If one bar is selected it reads: "Total Number of Transactions in Zone _". The underscore here would be replaced by the letter.

 

3) If two bars are selected it reads: "Total Number of Transactions in Zones _ & _".

 

4) If three or more bars are selected it reads "Total Number of Transactions in Zones _ , _ & _ ". And so on. 

 

Please find attached a link of the file which I am sharing here:

 

https://www.mediafire.com/file/npqmq5g0rm619xc/Sample_Data.pbix/file

 

Any help would be greatly appreciated. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @HamidBee ,

Here are the steps you can follow:

1. Create measure.

1&&7 =
var _discount=DISTINCTCOUNT(Data[Area])
var _max=MAX('Data'[Area])
return
SWITCH(
    TRUE(),
    _discount=7,"Total Number of Transactions",
    _discount=1,"Total Number of Transactions in Zone"&" "&_max)
2&&6 =
var _discount=DISTINCTCOUNT(Data[Area])
VAR _area = CONCATENATEX(
VALUES(Data[Area]),Data[Area],",")
var _len=LEN(_area)
var _replace=
REPLACE(_area,_len-1,1,"&")
return
"Total Number of Transactions in Zones " & _replace & ""
True =
var _discount=COUNT(Data[Area])
return
IF(
    _discount in {1,7},[1&&7],
    [2&&6])

2. Result:

Sovle1:

vyangliumsft_0-1648176858165.png

Sovle2:

vyangliumsft_1-1648176858166.png

Solve3:

vyangliumsft_2-1648176858168.png

Solve4:

vyangliumsft_3-1648176858170.png

 

Best Regards,

Liu Yang

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

Hi  @HamidBee ,

Here are the steps you can follow:

1. Create measure.

1&&7 =
var _discount=DISTINCTCOUNT(Data[Area])
var _max=MAX('Data'[Area])
return
SWITCH(
    TRUE(),
    _discount=7,"Total Number of Transactions",
    _discount=1,"Total Number of Transactions in Zone"&" "&_max)
2&&6 =
var _discount=DISTINCTCOUNT(Data[Area])
VAR _area = CONCATENATEX(
VALUES(Data[Area]),Data[Area],",")
var _len=LEN(_area)
var _replace=
REPLACE(_area,_len-1,1,"&")
return
"Total Number of Transactions in Zones " & _replace & ""
True =
var _discount=COUNT(Data[Area])
return
IF(
    _discount in {1,7},[1&&7],
    [2&&6])

2. Result:

Sovle1:

vyangliumsft_0-1648176858165.png

Sovle2:

vyangliumsft_1-1648176858166.png

Solve3:

vyangliumsft_2-1648176858168.png

Solve4:

vyangliumsft_3-1648176858170.png

 

Best Regards,

Liu Yang

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

PijushRoy
Super User
Super User

Hi @HamidBee 

Please try this

DynamicTitle = VAR _area = CONCATENATEX(
VALUES(Data[Area]),Data[Area],",")
return
SWITCH(
TRUE(),
COUNTA(Data[Area])=7, "Total Number of Transactions",
"Total Number of Transactions in Zones " & _area & "")

00.png01.png
 
If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos
 



Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





I like the idea however the ampersands (&) are missing in conditions 3 and 4. 

 

 

Hi @HamidBee 

You can change the text format as per your requirement.


If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Thank you but I Think the code will need some considerable adjustment inorder to achieve this. At the moment the code you have provided doesn't fall in line with my 3rd and 4th requirement. But thanks anyway. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors