Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register 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] ) ) )
)
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 |
---|---|
14 | |
11 | |
10 | |
10 | |
10 |
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
8 |