Forum Discussion

Petanek333's avatar
Petanek333
Helper III
3 years ago
Solved

Creating dynamic groups based on a measure

Hi, I would like to create groups of data based on a measure. To be honest, I don't even know if it is possible. I have a table like this: It basicaly says that in a week number 33 there were...
  • v-jingzhang's avatar
    3 years ago

    Hi Petanek333 

     

    You can try this measure 

    Measure = 
    VAR _table = SUMMARIZE('Dummy Data','Dummy Data'[ID],"week_remaining_new",[Weeks Remaining NEW],"max_week_inventory_value",[Max Week Inventory Value])
    RETURN
    SWITCH(SELECTEDVALUE('Stock Category'[Type]),
        "N/A",SUMX(FILTER(_table,[week_remaining_new]<=0),[max_week_inventory_value]),
        "Running Out",SUMX(FILTER(_table,[week_remaining_new]>0 && [week_remaining_new]<=8),[max_week_inventory_value]),
        "Perfect",SUMX(FILTER(_table,[week_remaining_new]>8 && [week_remaining_new]<=18),[max_week_inventory_value]),
        "Too much",SUMX(FILTER(_table,[week_remaining_new]>18),[max_week_inventory_value])
    )

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.