Forum Discussion

SESLewis's avatar
SESLewis
Frequent Visitor
3 years ago
Solved

Comparison to Selection Query

Hi,   New to Power BI and DAX so please bear with me - For context and to simplify, I have a selection of products of which, we apply a performance 'score' to the material they are made from.   I...
  • v-yueyunzh-msft's avatar
    3 years ago

    Hi , SESLewis 

    According to your description, you want to "Comparison to Selection Query".
    Now, i have found no way to update the measures' name according to the filter selection.

    Here are the steps you can refer to :
    (1)This is my test data:

    (2)We need to click "New Table" to create a calculated table as a slicer and we do not need to create any relationship between two tables:

    Table 2 = VALUES('Table'[Product])

     

     

    (3)I create a measre to test :

    Material Performance Measure = SUM('Table'[Material Performance])
     
    (4)Then we can create  a measure like this:

    Var to Product = var _select = MAX('Table 2'[Product])
    var _t =FILTER( ADDCOLUMNS( ALLSELECTED('Table'[Product]) , "value" , [Material Performance Measure]) , [Product] = _select)
    return
    [Material Performance Measure]-SUMX(_t ,[value])

     

    Then we can put the fields we need on the visual adn we can meet your need:

     

     

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

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