Forum Discussion
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
- PhilipTreacy
Super User
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
Community 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.