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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
lherbert501
Helper V
Helper V

Dynamic Title Field Parameter

Hi,

 

I have my measure below which it accepts the dax okay.

 

TESTDynamicTitle =
VAR a =
    CALCULATE ( DISTINCTCOUNT ( DimDate[Month] ), ALLSELECTED ( DimDate[Month] ) )
VAR b =
    CALCULATE ( DISTINCTCOUNT ( DimDate[Month] ), ALL ( DimDate[Month] ) )
return

  "" &
  CONCATENATEX (
        VALUES ( 'Parameter'[Parameter] ),
       'Parameter'[Parameter],
        " ,")
    & " Sales for " & IF( a = b, FIRSTNONBLANK(DimDate[YearNumCal],1), FIRSTNONBLANK(DimDate[Month],1 ))
 
 
But when I put it into the dynamic title I get the below error. 
I've looked into Using SELECTEDVALUE with Fields Parameters in Power BI - SQLBI which looks similar, but I cant seem to get it to like the dax. Is there an alternative method?
 
Thankyou
 
lherbert501_0-1677229413932.png

 

 
 
 
1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @lherbert501 

The easiest fix would be to change

 

CONCATENATEX (
    VALUES ( 'Parameter'[Parameter] ),
    ...

 

into

 

CONCATENATEX (
    'Parameter',
    ...

 

Since there should be no duplicates in the 'Parameter'[Parameter] column, the result should be as intended.

 

Passing a field parameter column reference to VALUES suffers from the same underlying problem as passing one to SELECTEDVALUE.

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

3 REPLIES 3
kaisrec
Helper I
Helper I

@lherbert501 , is it possible to apply the same logic to column header?
Use a Function in Field Parameters Header - Microsoft Fabric Community

OwenAuger
Super User
Super User

Hi @lherbert501 

The easiest fix would be to change

 

CONCATENATEX (
    VALUES ( 'Parameter'[Parameter] ),
    ...

 

into

 

CONCATENATEX (
    'Parameter',
    ...

 

Since there should be no duplicates in the 'Parameter'[Parameter] column, the result should be as intended.

 

Passing a field parameter column reference to VALUES suffers from the same underlying problem as passing one to SELECTEDVALUE.

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Thankyou @OwenAuger 

 

It seems so simple now I see it! 😀

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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