Forum Discussion

Chanleakna123's avatar
Chanleakna123
Icon for Post Prodigy rankPost Prodigy
3 years ago
Solved

Turn Condition measure into Column In order to do Some slicer

Hi All , 

i have successfully done the condition measure as per below . and i would like to turn this into column , the intention to do so is , that would be easier to do some filter on each rank as apply . in the meantime , i couldn't perform any filter or slicer because it's measure . may i know how can we acheive this ? 

 

test =
SWITCH (
    TRUE (),
    [%Growth 330-Sell both]  > -0.1, ">00%",
     [%Growth 330-Sell both]  > -0.2, ">10%",
     [%Growth 330-Sell both] > -0.5, ">30%",
      [%Growth 330-Sell both]  > -0.7, "50%",
    [%Growth 330-Sell both] > -1, ">70%",    
    ">100%"
)

 

  • Hi , Chanleakna123 

    Here are the steps you can refer to :

    (1)My test data is teh same as yours.

    (2)We can click "New Column "to create a calculated column :

    Deciling Bank = var _current_customer = 'Table'[Customer Code]
    var _cunrrent_year = YEAR('Table'[Date])
    var _last_year =SUMX( FILTER('Table','Table'[Customer Code]=_current_customer && YEAR('Table'[Date]) =_cunrrent_year -1 ) ,[Vol])
    var _this_year =SUMX( FILTER('Table','Table'[Customer Code]=_current_customer && YEAR('Table'[Date]) =_cunrrent_year  ) ,[Vol])
    var _Growth = DIVIDE( _this_year - _last_year , _last_year)
    return
    IF(_Growth <0  , SWITCH(TRUE() , _Growth>=-0.1 && _Growth<=0 ,"0%-10%" , _Growth>=-0.3 && _Growth<-0.1 ,"10%-30%",_Growth>=-0.5 && _Growth<-0.3,"30%-50%",_Growth>=-0.7 && _Growth<-0.5 ,"50%-70%",_Growth>=-0.9 && _Growth<-0.7,"70%-90%" , _Growth>=-1 && _Growth<-0.9 ,"90%-100%+" )            , BLANK())

    (2)Then we can meet your need , the result is as follows:

    (3)The second need I have realized in the "Report" view , you can see it in the .pbix file .

     

    If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

     

    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

8 Replies

  • Hi , Chanleakna123 

    Here are the steps you can refer to :

    (1)This is my test data :

    (2)We need to create a table like this:

    (3)Then we can create a measure :

    Measure = var _slicer_table = VALUES('Slicer Table'[Compare])
    var _min_slicer = MINX(_slicer_table,[Compare])
    var _value =SELECTEDVALUE('Table'[%Growth 330-Sell both])
    return
    IF( _value > _min_slicer ,1,0)

    (4)Then we can put the measure on the "filter on this visual" then we can meet your need:

     

    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

    • Chanleakna123's avatar
      Chanleakna123
      Icon for Post Prodigy rankPost Prodigy

      Hi v-yueyunzh-msft  , the Growth 330-sell both is a measure as i am having right now. 

      and when i use the formula seems not working on the measure of Growth 330-sell both. 

      can you please help on this ? 

       

      this is my mesure of growth rate : 

      %Growth-Selling Both = IFERROR(([Vol.PC330+185ml-Both Selling]-[LY-Store selling both])/[LY-Store selling both],0)

       

      my purpose is to put into the visual , to see which customer is piloting into any rank . 

      Measure = var _slicer_table = VALUES('Slicer Table'[Compare])
      var _min_slicer = MINX(_slicer_table,[Compare])
      var _value =SELECTEDVALUE('Table'[%Growth 330-Sell both])
      return
      IF( _value > _min_slicer ,1,0)

       

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

        Hi , Chanleakna123 

        If it is a measure , you just need to modify the "_value" parameter in the dax :

        Measure = var _slicer_table = VALUES('Slicer Table'[Compare])
        var _min_slicer = MINX(_slicer_table,[Compare])
        var _value =[Your Measure]
        return
        IF( _value > _min_slicer ,1,0)

        Then we can realize it.

        If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

         

        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