Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

How to create multiple Ranges in Dax (average unit prices)

I've got a table with the below headers....   I will post a sample file if needed, I just thought this potentially could be easy for the experts here 🙂 All I want to do is create anot...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  Anonymous ,

    I created some data:

    Here are the steps you can follow:

    1. Create calculated column.

    Divide =
    DIVIDE([POS Units],[POS Value])
    Avg =
    AVERAGEX(FILTER(ALL('Table'),'Table'[style]=EARLIER('Table'[style])),[Divide])
    ranges =
    SWITCH(
        TRUE(),
        [Avg]>=0&&[Avg]<=5,"$0-$5",
        [Avg]>=5.01&&[Avg]<=10,"$5.01-$10",
        [Avg]>=10.01&&[Avg]<=20,"$10.01-$20",
        ">$20")

    2. Result:

     

    Best Regards,

    Liu Yang

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