Forum Discussion

ocifci's avatar
ocifci
Frequent Visitor
9 years ago
Solved

Purchase price grouping

Hi all! I'm a beginner who's very confused about how I would go about achieving the below and hope you can help :)

 

I have a Property Purchase Price column and would like to create a bar chart that on the X-axis shows a count of properties where the purchase price was <£1m, £1m - £3m, £3m - £5m, £5m - £10m, £10+, and on the Y-axis shows the count of properties purchased at the price range in the X-axis.

 

Many thanks!

  • Hey,

     

    create a column that sorts the "Purchase Price" into buckets like so

     

    Purchase Price Buckets = 
    SWITCH(
        TRUE()
        ,'yourtable'[Purchase Price] < 1000000, "<1m"
        ,'yourtable'[Purchase Price] >= 1000000 && 'yourtable'[Purchase Price] <= 3000000, " 1m - 3m"
    ,...
        , "> 10m")

    Then you can use this column as xaxis. Use the property as value and the aggregation function count.

     

    Hope this gets you started

     

    Regards

4 Replies

  • Hey,

     

    create a column that sorts the "Purchase Price" into buckets like so

     

    Purchase Price Buckets = 
    SWITCH(
        TRUE()
        ,'yourtable'[Purchase Price] < 1000000, "<1m"
        ,'yourtable'[Purchase Price] >= 1000000 && 'yourtable'[Purchase Price] <= 3000000, " 1m - 3m"
    ,...
        , "> 10m")

    Then you can use this column as xaxis. Use the property as value and the aggregation function count.

     

    Hope this gets you started

     

    Regards

    • ocifci's avatar
      ocifci
      Frequent Visitor

      Hi Tom

       

      Thank you for this. It worked perfectly!

       

      Many thanks and have a great day! :)

       

      OC

      • TomMartens's avatar
        TomMartens
        Super User

        Welcome in the wonderful and sometimes mysterious world of Power BI

         

        Regards

    • Anonymous's avatar
      Anonymous
      Not applicable

      TomMartens,

      I see your answer to the below and it's very similar to what I've come up with. The trouble I'm having is that my columns do not follow a logical sorting pattern when presented. In your example I'd want the columns to sort with <1M, then 1-3M, and so on. But when I sort my columns that data seems to just pick up the first digit. Once I get to 10M vs. 1M this causes issues. 

       

      Any suggestions on how to make this work?

       

      Thanks in advance for any help on this