Forum Discussion

Wresen's avatar
Wresen
Icon for Post Patron rankPost Patron
3 years ago
Solved

Calculate values in table with slicer input.

Hi and thx for reading this,

I have a problem that i really have no clue on even if its possible to do 

(i hope i can explain what i mean)

 

I have:
A table made with 2 value for the slicer (10 and 20)
An Item table 
An Cost table 

What i want is that the slicer value should minus the Cost in Item table and i want to be able to see the counts of the new cost result in the Cost table
in the example (green) the slicer has 10 and we have minus all the cost in Item table with 10 and are able to present the count of ech new cost on the Cost table.
i want to be able to see the Cost table and the result when i change the slicer to new values

 

/Thanks

  • Hi , Wresen 

    Here are the steps you can refer to :

    This is my test data:

    We can create a measure like this:

    Count = var _flag = ISFILTERED('Slicer Table'[Value])
    var _slicer_value  = IF(_flag = TRUE() , MAX('Slicer Table'[Value]) ,0)
    var _t = ADDCOLUMNS('Item Table' , "minus" , [Cost]-_slicer_value)
    var _cur_cost = MAX('Cost Table'[Cost])
    var _count = FILTER( _t , [minus] = _cur_cost)
    return
    COUNTROWS(_count)

    Then 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

     

     

4 Replies

  • Wresen ,The information you have provided is not making the problem clear to me. Can you please explain with an example.

    Appreciate your Kudos.

      • v-yueyunzh-msft's avatar
        v-yueyunzh-msft
        Icon for Community Support rankCommunity Support

        Hi , Wresen 

        Here are the steps you can refer to :

        This is my test data:

        We can create a measure like this:

        Count = var _flag = ISFILTERED('Slicer Table'[Value])
        var _slicer_value  = IF(_flag = TRUE() , MAX('Slicer Table'[Value]) ,0)
        var _t = ADDCOLUMNS('Item Table' , "minus" , [Cost]-_slicer_value)
        var _cur_cost = MAX('Cost Table'[Cost])
        var _count = FILTER( _t , [minus] = _cur_cost)
        return
        COUNTROWS(_count)

        Then 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