Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Measure fetch 2 values from slicer

Hi,

I need to select 2 values from slicer to populate the correct value.

How to modify the measure to the below selectedvalue?

[Product]

Slicer [Country]

Slicer [ Name]

Product A

US

Product A

Product B

US

Product B

Product C

Canada

 

 

Measure =
IF(
    ISFILTERED(Slicer[Name]),
    SWITCH(
        SELECTEDVALUE(Slicer[Name]),
        "Product A",CALCULATE(MAX([Value]),FILTER('Table',[Product]="Product A")),
        "Product B",CALCULATE(MAX([Value]),FILTER('Table',[Product]="Product B")),
        "Product C",CALCULATE(MAX([Value]),FILTER('Table',[Product]="Product C"))),
    CALCULATE(MAX([Value]),FILTER('Table',[Product]="All")))

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous,

    Perhaps you can try the following measure formula if it meets your requirement:

    Measure =
    CALCULATE (
        MAX ( [Value] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            IF (
                ISINSCOPE ( Slicer[Country] ),
                [Country] IN VALUES ( Slicer[Country] ),
                [Country] = "All"
            )
                && IF (
                    ISINSCOPE ( Slicer[Name] ),
                    [Name] IN VALUES ( Slicer[Name] ),
                    [Name] = "All"
                )
        )
    )
    

    Regards,

    Xiaoxin Sheng

4 Replies

  • Anonymous , Not able to relate what is raw data, What are the slicers? Are slicer independent so we need handle. What is final outcome needed

  • Anonymous , Try a measure like

    Measure =
    IF(
        ISFILTERED(Slicer[Name]) || ISFILTERED(Slicer2[Name]) ,
        CALCULATE(MAX([Value]),FILTER('Table','Table'[Product]  in allselected(Slicer[Name])  && 'Table'[COUNTRY]  in allselected(Slicer2[Name]) )))
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

    Perhaps you can try the following measure formula if it meets your requirement:

    Measure =
    CALCULATE (
        MAX ( [Value] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            IF (
                ISINSCOPE ( Slicer[Country] ),
                [Country] IN VALUES ( Slicer[Country] ),
                [Country] = "All"
            )
                && IF (
                    ISINSCOPE ( Slicer[Name] ),
                    [Name] IN VALUES ( Slicer[Name] ),
                    [Name] = "All"
                )
        )
    )
    

    Regards,

    Xiaoxin Sheng