Forum Discussion

Snagalapur's avatar
Snagalapur
Helper IV
1 year ago
Solved

Text based on Field parameter selection

Hi All,

 

Please suggest measure to udpate text based on Field parameter selction. EX, below

 

Field Parameter:

Seg/BU/Sub BU/Product = {
    ("Segment", NAMEOF('Table'[pl1_descr]), 0),
    ("BU", NAMEOF('Table'[pl2_descr]), 1),
    ("Sub BU", NAMEOF('Table'[pl3_descr]), 2),
    ("Product Grp", NAMEOF('Table'[pl4_descr]), 3),
    ("Product", NAMEOF('Table'[pl5_descr]), 4)
}
 
Measure (which is not working)
Placeholder text =
VAR selectedValue = SELECTEDVALUE('Seg/BU/Sub BU/Product'[Seg/BU/Sub BU/Product Fields])
RETURN
IF(
NOT ISBLANK(selectedValue) ,
"No Selection"
)

 

  • Snagalapur , Try using

    DAX
    PlaceholderText =
    VAR selectedValue = SELECTEDVALUE('Seg/BU/Sub BU/Product'[Seg/BU/Sub BU/Product Fields])
    RETURN
    IF(
    ISBLANK(selectedValue),
    "No Selection",
    SWITCH(
    selectedValue,
    0, "Segment",
    1, "BU",
    2, "Sub BU",
    3, "Product Grp",
    4, "Product",
    "Invalid Selection"
    )
    )

8 Replies

  • Hello Snagalapur 

     

    You can try this

     

    Placeholder Text =
    VAR selectedValue = SELECTEDVALUE('Seg/BU/Sub BU/Product'[Seg/BU/Sub BU/Product Fields])
    VAR result =
    SWITCH(
    TRUE(),
    selectedValue = "Segment", "Segment Selected",
    selectedValue = "BU", "BU Selected",
    selectedValue = "Sub BU", "Sub BU Selected",
    selectedValue = "Product Grp", "Product Group Selected",
    selectedValue = "Product", "Product Selected",
    "No Selection"
    )
    RETURN
    result

     

     

    Thanks,
     Pankaj Namekar | LinkedIn

    If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

    • Snagalapur's avatar
      Snagalapur
      Helper IV

      thank you for details,  I have issue code is returning No selection here.

  • Snagalapur , Try using

    DAX
    PlaceholderText =
    VAR selectedValue = SELECTEDVALUE('Seg/BU/Sub BU/Product'[Seg/BU/Sub BU/Product Fields])
    RETURN
    IF(
    ISBLANK(selectedValue),
    "No Selection",
    SWITCH(
    selectedValue,
    0, "Segment",
    1, "BU",
    2, "Sub BU",
    3, "Product Grp",
    4, "Product",
    "Invalid Selection"
    )
    )

  • Your logic is working, as you have something selected, it returns No selection

    To avoid this issue, the following approach should solve

     

    Placeholder Text =
    VAR SelectedValue = SELECTEDVALUE('Seg/BU/Sub BU/Product'[Seg/BU/Sub BU/Product Fields])
    RETURN
    IF(
    ISBLANK(SelectedValue),
    "No Selection",
    SelectedValue
    )

  • v-priyankata's avatar
    v-priyankata
    Community Support

    Hi Snagalapur 

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

  • v-priyankata's avatar
    v-priyankata
    Community Support

    Hi Snagalapur 
    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank you.

  • v-priyankata's avatar
    v-priyankata
    Community Support

    Hi Snagalapur 
    I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
    Thank you.