Forum Discussion

User_266's avatar
User_266
Frequent Visitor
2 years ago
Solved

Creating number ranges with Dax

Hello, I have a Dataset that has a "Weight" column with numerical values representing weights. For example : | 267890 | | 225098 | | 194682 | | 224534 | | 258943 | | 262306 | | 27178...
  • AlexisOlson's avatar
    2 years ago

    You can create a series like this:

    VAR _Max = 272000
    VAr _Incr = 2500
    VAR _Min = INT ( MIN ( Table1[Weight] ) / _Incr  ) * _Incr
    RETURN
        GENERATESERIES ( _Min, _Max, _Incr )

     

    If you want it just as a calculated column on your existing table, then try:

    Range = 
    VAr _Incr = 2500
    VAR _Min = INT ( Table1[Weight] / _Incr  ) * _Incr
    VAR _Max = MIN ( 272000, _Min + _Incr )
    RETURN
        _Min & " - " & _Max