Forum Discussion

JCG99's avatar
JCG99
Regular Visitor
2 years ago
Solved

Grouping with gaps

Hello, I am trying to group data with gaps inside them. This is a sample of my data:   distance from distance to  built year  Type road  Living area  Zone State  0 10 1990 Alley Ye...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi JCG99 

    Please try the following DAX:

    Min from = 
    VAR _selectyear =  SELECTEDVALUE('Table'[built year ])
    VAR _selecttype = SELECTEDVALUE('Table'[Type road ])
    RETURN
    MINX(FILTER(ALL('Table'),'Table'[built year ] = _selectyear && 'Table'[Type road ]=_selecttype),'Table'[distance from])
    Max to = 
    VAR _selectyear =  SELECTEDVALUE('Table'[built year ])
    VAR _selecttype = SELECTEDVALUE('Table'[Type road ])
    RETURN
    MAXX(FILTER(ALL('Table'),'Table'[built year ] = _selectyear && 'Table'[Type road ]=_selecttype),'Table'[distance to ])

     

    Result:

     

     

     

     

    Best Regards,

    Jayleny

     

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