Forum Discussion
Anonymous
9 years agoNot applicable
DAX Statement Help - counts within column
I am currently using a DAX function to indicate whether particluar row (unit of inventory) is Sold or Available. This is column that is added to the dataset in PowerBI (for each row) using an "if" st...
- 9 years ago
Hi Anonymous,
If you have got a column which has the actual values
EG: Column name: Status
- Column Values: Available, Sold
Then what you can do is to create the following Measures
Total Inventory = CountRows('TableName') Available = CALCULATE([Total Inventory],'TableName'[Status] = "Available") Sold = CALCULATE([Total Inventory],'TableName'[Status] = "Sold") % Units Available = DIVIDE([Available],[Total Inventory]) % Units Sold = DIVIDE([Sold],[Total Inventory])
GilbertQ
9 years agoSuper User
Hi Anonymous,
If you have got a column which has the actual values
EG: Column name: Status
- Column Values: Available, Sold
Then what you can do is to create the following Measures
Total Inventory = CountRows('TableName')
Available = CALCULATE([Total Inventory],'TableName'[Status] = "Available")
Sold = CALCULATE([Total Inventory],'TableName'[Status] = "Sold")
% Units Available = DIVIDE([Available],[Total Inventory])
% Units Sold = DIVIDE([Sold],[Total Inventory])