Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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