Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
I have the following table:
Bill ID Item Name Quantity
101 Coffee 1
101 Salad 2
101 Sandwich 1
102 Muffin 3
102 Cookie 3
103 Coffee 1
104 Sandwich 1
104 Cookie 3
I would like to get the two following two tables:
Bill ID Quantity
101 4
102 6
103 1
104 4
Quantity Bill Count
1 1
4 2
6 1
What is the best way to do it?
Thanks,
Ohad
Solved! Go to Solution.
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
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
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @MFelix
The solution is not working because in the first result table the quntity values (second column) are sum of quantity for each bill ID and in the second resault table the quatinty values (first column) are distinct values of quantity and it's not the same.
Buttom line, the second resault table should contain distinct values of the sum of quantity from the first result table and only then to count the bills.
Thanks for your help,
Ohad
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
75 | |
68 | |
41 | |
35 |
User | Count |
---|---|
107 | |
56 | |
52 | |
48 | |
40 |