Forum Discussion

JFAschoon's avatar
JFAschoon
Icon for Helper I rankHelper I
2 years ago

Converting a measure to column

Good day

 

I have the following measure. how do i convert it to a column syntex.

 

Show=
var a = filter(allselected('CM18'),'CM18'[Event]="PumpOFF")
return if(SELECTEDVALUE('CM18'[Index.0]) in UNION(SELECTCOLUMNS(a,"Index",[Index.0]),SELECTCOLUMNS(a,"Index",[Index.0]-1),SELECTCOLUMNS(a,"Index",[Index.0]+1)),1,0)

 

Thanks in advance for any assistance

2 Replies

  • Hi JFAschoon 

     

    Can you provide sample data, and explain what the column is suposed to contain?

     

    Hard to work this out just be looking at some code.

     

    Phil

  • v-zhangti's avatar
    v-zhangti
    Icon for Community Support rankCommunity Support

    Hi, JFAschoon 

     

    You can try the following methods.

    Column1 = SELECTCOLUMNS(FILTER(ALLSELECTED('CM18'), 'CM18'[Event] = "PumpOFF"), "Index", [Index.0])
    Column2 = SELECTCOLUMNS(FILTER(ALLSELECTED('CM18'), 'CM18'[Event] = "PumpOFF"), "Index", [Index.0] - 1)
    Column3 = SELECTCOLUMNS(FILTER(ALLSELECTED('CM18'), 'CM18'[Event] = "PumpOFF"), "Index", [Index.0] + 1)
    Column4 = IF(SELECTEDVALUE('CM18'[Index.0]) IN UNION(Column1, Column2, Column3), 1, 0)

    It can be tested to see if it fits your situation. If it fails to resolve, please provide example data.

     

    Best Regards,

    Community Support Team _Charlotte

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