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.
Hi, I have seen quite a few posts relating to ways of emulating COUNTIF in excel but none of them seem to match what I am after. I have a table in Power BI Desktop I need to add a column that shows an incremental count each time a duplicate value is found in another column. Any help would be appreciated.
RefNumber | NewColumn |
2254 | 1 |
2255 | 1 |
2255 | 2 |
2255 | 3 |
2256 | 1 |
2256 | 2 |
2257 | 1 |
2258 | 1 |
2259 | 1 |
2259 | 2 |
2259 | 3 |
2259 | 4 |
2260 | 1 |
Solved! Go to Solution.
Hi @Metstone
First you need to have a column that establishes an order. Go to the query editor and add an index column (Add Column -> Add Index column)
Then in DAX you can create a new calculated column:
NewCol = CALCULATE ( COUNT ( Table1[RefNumber] ), ALLEXCEPT ( Table1, Table1[RefNumber] ), Table1[Index] <= EARLIER ( Table1[Index] ) )
Hi @Metstone
First you need to have a column that establishes an order. Go to the query editor and add an index column (Add Column -> Add Index column)
Then in DAX you can create a new calculated column:
NewCol = CALCULATE ( COUNT ( Table1[RefNumber] ), ALLEXCEPT ( Table1, Table1[RefNumber] ), Table1[Index] <= EARLIER ( Table1[Index] ) )
Thanks!! That's exactly what I needed.
User | Count |
---|---|
14 | |
12 | |
8 | |
6 | |
5 |
User | Count |
---|---|
29 | |
18 | |
13 | |
8 | |
5 |