Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
i got a csv file with an id and transaction i need to count for each id how many transaction line there is
in this case for id 8 should be 5
an easy task but i can find out right now im stuck
count row same id
You can use something like this
Column =
Var new = Table1[id]
Var Count1 = CALCULATE(
COUNTROWS(Table1),
all(Table1),
Table1[id] = new
)
Return Count1
@Anonymous
Column =
Var new = transactions[CustomerID]
Var Count1 = CALCULATE(
COUNTROWS(transactions),
all(transactions),
transactions[CustomerID] = new
)
Return Count1))
name of table column : transactions[CustomerID]
I got an error
The syntax for ')' is incorrect. (DAX(Var new = transactions[CustomerID]Var Count1 = CALCULATE(COUNTROWS(transactions),all(transactions),transactions[CustomerID] = new)Return Count1)))).
Please make sure you have correct opening and closing brackets in your column definition.
I created the column and got no errors
Column =
Var new = Table1[ID]
Var Count1 = CALCULATE(
COUNTROWS(Table1),
all(Table1),
Table1[ID] = new
)
Return Count1
count =
Var new = transactions[CustomerID]
Var Count1 = CALCULATE(
COUNTROWS(transactions),
all(transactions),
transactions[CustomerID] = new
)
Return Count1
A single value for column 'CustomerID' in table 'transactions' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
@Anonymous
are you creating it as column or measure?
The example I gave is for creating a column and not a measure.
@Anonymous
I tried both but same error
Hi @snifer,
That's weird. Can you share some snapshots?
Please also try this one. It's a calculated column.
Column = CALCULATE ( COUNT ( transactions[CustomerID] ), ALLEXCEPT ( transactions, transactions[CustomerID] ) )
Best Regards,
Dale
The simplest way would be to create a measure like this
Measure = COUNTROWS(Table1)
On the report canvas, drag the id field and this measure onto a table visualization
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
142 | |
108 | |
101 | |
81 | |
74 |