Forum Discussion

corporate's avatar
corporate
Icon for Helper I rankHelper I
6 years ago
Solved

Filter from measure in a table

Hi everyone, I am new on Power BI and I'm trying to build a filter from a measure in a table. Here is my problem:   1) I import a table in Power BI with raw data: production values grouped by seve...
  • v-alq-msft's avatar
    6 years ago

    Hi, corporate 

    Based on your description, I created data to reproduce your scenario.

    Table:

     

    Test (a calculated table):

     

     

    Test = GENERATESERIES(0,10000,1)

     

     

     

    You may create three measures as below.

     

     

    Slicer Control = 
    var t =
    SUMMARIZE(
        'Table',
        'Table'[Region],
        'Table'[Province],
        "MeasureValue",CALCULATE([Measure])
    )
    return IF(
        COUNTROWS(
            FILTER(
                t,
                [MeasureValue]=SELECTEDVALUE(Test[Value])
            )
        )>0,
        1,
        -1
    )
    
    Table Control = 
    IF([Measure] in DISTINCT('Test'[Value]),1,-1)
    
    Measure = SUM('Table'[Production])

     

     

     

    Then you need to put 'Slicer Control' in the visual level filter of 'Value' slicer and put 'Table Control' in the visual level filter of table visual.

     

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.