The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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 |
---|---|
15 | |
13 | |
8 | |
6 | |
6 |
User | Count |
---|---|
27 | |
19 | |
12 | |
9 | |
7 |