Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello,
I have a Table where Code is unique.
I would like to get a division of stock by count of Group values please
Eg.
Stock = 40, count of Jeans=2 so 40/2=20
Code | Group | stock | Result I would like to get |
101 | Jeans | 40 | 20 |
102 | Jeans | 40 | 20 |
103 | Suits | 60 | 20 |
104 | Suits | 60 | 20 |
105 | Suits | 60 | 20 |
106 | Shoes | 10 | 10
|
Thank You
Solved! Go to Solution.
Hi @MasterSonic
please try
CalculatedColumn =
DIVIDE (
'Table'[Stock],
COUNTROWS ( CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[Group] ) ) )
)
you may also try
Column=
VAR CurrentGroup = TableName[Group]
VAR CurrentStockType = TableName[Stock]
VAR CurrentGroup =
COUNTROWS(
FILTER(
TableName,
TableName[Group] = CurrentStockType
)
)
RETURN
DIVIDE ( CurrentGroup, CurrentGroup )
Hi there,
I did try your solution and have an issues.
Shouldn't be second
VAR CurrentGroup
Different name like CurrentGroup2 ?
I have error about that.
I did change it , but still showing that can not transform values from Group of type text into number
Hi @MasterSonic
please try
CalculatedColumn =
DIVIDE (
'Table'[Stock],
COUNTROWS ( CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[Group] ) ) )
)
User | Count |
---|---|
14 | |
10 | |
7 | |
6 | |
5 |
User | Count |
---|---|
30 | |
19 | |
12 | |
7 | |
5 |