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

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

Reply
Kalachuchi
Helper III
Helper III

Dynamic Commentary based from column and slicer

I have two tables which are connected via unique ID

UniqueIDYearNameSales
12019Arthur Morgan2
22020James Morgan45

 

Slicer

UniqueIDRegion
1OC
2ASEAN

 

So when the user has clicked OC in slicer the commentary will be "In 2019, Arthur Morgan from OC region has a sale count of 2"

then if ASEAN is clicked "In 2020, James Morgan from ASEAN region has a sale count of 45"

 

I have no idea if this is possible or not, Any help will greatly be appreciated.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Kalachuchi  ,

Here are the steps you can follow:

1. Create calculated column.

Comment =
var _OC=CALCULATE(MAX('Table (2)'[Region]),FILTER('Table (2)',[UniqueID]=EARLIER('Table'[UniqueID])))
return
"In "&[Year]&", "&[Name]&" from "&_OC&" region has a sale count of "&[Sales]

2. Result

2020.12.10.111.png

You can downloaded PBIX file from here.

 

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

3 REPLIES 3
Anonymous
Not applicable

Hi  @Kalachuchi  ,

Here are the steps you can follow:

 1. Create measure.

Measure =
var _select =SELECTEDVALUE('Table (2)'[Region])
var _OC=CALCULATE(MAX('Table (2)'[Region]),FILTER('Table (2)',[UniqueID]=MAX('Table'[UniqueID])))
var _amount=SUM('Table'[Sales])
return
IF(_select=MAX('Table (2)'[Region]),
"In "&MAX('Table'[Year])&", "&MAX('Table'[Name])&" from "&_OC&" region has a sale count of "&MAX('Table'[Sales]),"The total amount of sales in two years is"&" "&_amount&"")

 2. Result.

 

v-yangliu-msft_0-1607658645937.png

You can downloaded PBIX file from here.

 

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.

Anonymous
Not applicable

Hi  @Kalachuchi  ,

Here are the steps you can follow:

1. Create calculated column.

Comment =
var _OC=CALCULATE(MAX('Table (2)'[Region]),FILTER('Table (2)',[UniqueID]=EARLIER('Table'[UniqueID])))
return
"In "&[Year]&", "&[Name]&" from "&_OC&" region has a sale count of "&[Sales]

2. Result

2020.12.10.111.png

You can downloaded PBIX file from here.

 

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.

Is it possible to add if the user did not clicked any slicer it will give me a static text with the total number of sales?

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.