Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

dynamically result label

Hi ,

 

I want to dislplay selected filters/selections made by User in a textbox. In order to achieve this I have used below query

Label XX =
If(NOT(ISFILTERED(ACHFB_SDM_PBI_V[ACHFB])),"All ACHFB",Concatenate("ACHFB - ",If(ISFILTERED(ACHFB_SDM_PBI_V[ACHFB]),CONCATENATEX(VALUES(ACHFB_SDM_PBI_V[ACHFB]),ACHFB_SDM_PBI_V[ACHFB],",")))) 
 
From the above DAX  , I achieve following result ,if nothing selected from that table , it displays "All ACHFB"
If something is selected , like - Sofa, Bed etc then it displays in texbox "Sofa, Bed".

Now, I have one doubt, From the table "ACHFB_SDM_PBI_V" I have few rows as below

 

Here, Even  If nothing is selected by users, I want to display  "All ACHFB", but I want to get rid of the highlighed data"Invalid","Not aplicable"" etc.

For that I need DAX,. Please help.


 

 

 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

    I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can create a measure as below:

    Label XX = 
    IF (
        ISFILTERED ( 'ACHFB_SDM_PBI_V'[ACHFB] ),
        CONCATENATEX (
            FILTER (
                VALUES ( 'ACHFB_SDM_PBI_V'[ACHFB] ),
                NOT ( 'ACHFB_SDM_PBI_V'[ACHFB]
                    IN { "- - INVALID", "$ - NOT APPLICABLE", "- NOT AVAILABLE", "? - UNKNOWN" } )
            ),
            'ACHFB_SDM_PBI_V'[ACHFB],
            ","
        ),
        "All ACHFB"
    )

    Best Regards

2 Replies

  • Anonymous , try to add filter  concatenatex

     

    example, add additional values

     

    Label XX =
    If(NOT(ISFILTERED(ACHFB_SDM_PBI_V[ACHFB])),"All ACHFB",Concatenate("ACHFB - ",If(ISFILTERED(ACHFB_SDM_PBI_V[ACHFB]),
    calculate( CONCATENATEX(VALUES(ACHFB_SDM_PBI_V[ACHFB]),ACHFB_SDM_PBI_V[ACHFB],","), filter(ACHFB_SDM_PBI_V , not ACHFB_SDM_PBI_V[ACHFB] in {"--INVALID",""$_NOT APPLICABLE,"?-UNKNOWN"} ) ) )))

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can create a measure as below:

    Label XX = 
    IF (
        ISFILTERED ( 'ACHFB_SDM_PBI_V'[ACHFB] ),
        CONCATENATEX (
            FILTER (
                VALUES ( 'ACHFB_SDM_PBI_V'[ACHFB] ),
                NOT ( 'ACHFB_SDM_PBI_V'[ACHFB]
                    IN { "- - INVALID", "$ - NOT APPLICABLE", "- NOT AVAILABLE", "? - UNKNOWN" } )
            ),
            'ACHFB_SDM_PBI_V'[ACHFB],
            ","
        ),
        "All ACHFB"
    )

    Best Regards