Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Count the order number by Account

Hi, how to sum the number or orders per account? If the number of order per account >5, then set it as 5.   I have created the below measures, but the sum = 6 which is incorrect. Total Orders by...
  • Jihwan_Kim's avatar
    5 years ago

    Hi, Anonymous 

    Please check the below picture and the sample pbix file's link down below.

     

     

    Number of Orders Measure =
    VAR newtable =
    SUMMARIZE (
    'Table',
    'Table'[Account],
    "@orderscountcondition", IF ( COUNTROWS ( 'Table' ) >= 5, 5, COUNTROWS ( 'Table' ) )
    )
    RETURN
    SUMX ( newtable, [@orderscountcondition] )

     

    https://www.dropbox.com/s/f1203rsgdmonu5y/newuser.pbix?dl=0 

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM