Forum Discussion

mhdilyas2008's avatar
mhdilyas2008
Frequent Visitor
3 years ago
Solved

Dax query separate base onnIP Range

Im trying to separate base on ip range in between , example  Zone = IF(FILTER(Sheet1, Sheet1[Column2] >= "192.169.10.0" || Sheet1[Column2] <= "192.169.10.14"),"dmz","") does not work.
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi mhdilyas2008 ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) This is my test data. 

    (2) We can create calculated columns.

    LastDecimal = 
    VAR TextValue = 'Sheet1'[Column2]
    VAR LastDotPosition = MAXX(GENERATESERIES(1, LEN(TextValue)), IF(MID(TextValue, [Value], 1) = ".", [Value], BLANK()))
    RETURN IF(ISBLANK(LastDotPosition), BLANK(), MID(TextValue, LastDotPosition + 1, LEN(TextValue) - LastDotPosition))

     

    Flag = IF('Sheet1'[LastDecimal]>= 0 && 'Sheet1'[LastDecimal]<= 14 ,"dmz","")

    (3) Then the result is as follows.

    Best Regards,

    Neeko Tang

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