Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Calculate Min/Max and Count for each row

How to get a visual showing the MIN and MAX areas for each Apartment Code entry from the data in a table such as the one below?

 

Also, how do I format the %GT Area Apartment Code Total to show w/o decimal cases?

 

This is what I am aiming to do (fields in red are the ones I am trying to learn how to calculate)

 

Thanks in advance.

J

 

Apartment Code%GT Area Apartment Code TotalCount of Apartment CodeMIN AreaMAX Area
1 bed20.83%5142603
2 bed41.67%10140571
3 bed25.00%6123571
penthouse12.50%3400571

 

And this is what I have.

Apartment CodeArea
1 bed142.8353
1 bed300.4763
1 bed310.9436
1 bed372.24
2 bed140.3131
2 bed156.24
2 bed167.7358
2 bed171.4803
2 bed181.7823
2 bed243.7908
3 bed123.6074
3 bed400.2451
3 bed400.2451
3 bed405.3767
penthouse400.2451
penthouse405.3767
penthouse571.05
3 bed405.3767
3 bed571.05
2 bed303.8439
2 bed400.2451
2 bed405.3767
2 bed571.05
1 bed603.1788
  • Use the format area on the Modeling tab to decrease the number of decimal places to 0. Hit the up arrow because it is probably set to Auto at the moment.

     

    I believe that the two measures that you want are:

     

    MIN Area = MIN(Table[Area])
    
    MAX Area = SUM(Table[Area])

    If you put those in a table along with your [Apartment Code] you should get what you want.

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Use the format area on the Modeling tab to decrease the number of decimal places to 0. Hit the up arrow because it is probably set to Auto at the moment.

     

    I believe that the two measures that you want are:

     

    MIN Area = MIN(Table[Area])
    
    MAX Area = SUM(Table[Area])

    If you put those in a table along with your [Apartment Code] you should get what you want.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Greg_Deckler

      I do not think that the Modeling tab formatting applies to the % of Grant Total. See image below.

       

       

       

      The MIN and MAX work perfectly. So easy. So simple. Sometimes one gets bogged down with complicating things unnecessarily.

       

      May thanks.

       

       

       

  • Anonymous

     

    In your scenario, you want to calculate the MAX or MIN areas for each Apartment Code group. Right?

     

    To achieve your requirement, you can create calculated column with expression like:

     

    Min Area =
    CALCULATE (
        MIN ( 'Apartment Table'[Area] ),
        FILTER (
            'Apartment Table',
            'Apartment Table'[Apartment Code]
                = EARLIER ( 'Apartment Table'[Apartment Code] )
        )
    )
    MAX Area =
    CALCULATE (
        MAX ( 'Apartment Table'[Area] ),
        FILTER (
            'Apartment Table',
            'Apartment Table'[Apartment Code]
                = EARLIER ( 'Apartment Table'[Apartment Code] )
        )
    )

    The result shows like this:

     

    Thanks,
    Xi Jin.