Forum Discussion

Ohad's avatar
Ohad
Frequent Visitor
9 years ago
Solved

Count measure values

Hi,   I have the following table:   Bill ID                    Item Name                         Quantity 101                         Coffee                                  1 101              ...
  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi Ohad,

     

    You can simply use summarize function to achieve your requirement:

     

    Total Quantity = SUMMARIZE('111','111'[Bill ID],"Quantity",SUM('111'[Quantity]))

    Quantity Count = SUMMARIZE('Total Quantity','Total Quantity'[Quantity],"Bill Count",COUNT('Total Quantity'[Bill ID]))

     

    In addition, if you not want the "Total Quantity" table, you can direct use below formula to get the quantity count.

    Table 3 = 
    Var temp= SUMMARIZE('111','111'[Bill ID],"Quantity",SUM('111'[Quantity]))
    return
    SUMMARIZE(temp,[Quantity],"Bill Count",COUNTX(FILTER(temp,[Quantity]=EARLIER([Quantity])),[Bill ID]))

     

     

    Regards,

    Xiaoxin Sheng