Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I want to count how many times a specific pair of values occur and display the count next to them. How would I count a set of values and duplicate the count x number of times to line up with original value?
For this table the pairs would be in plant and type. So 'tree' & 'seed' show up 2 times, 'bush' & 'leaf' 3 times etc. How would I count that and then put a 2 next to each instance of tree and seed, and a 3 next to bush and leaf? Could I possibly make a new table with duplicates removed and then just count the pairs and put the total in the corresponding column? I want to be able to update the data and have it automatically recount the pairs so I don't know if making new tables is the best idea.
Solved! Go to Solution.
Hi,
This calculated column formula works
=CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[Plant]=EARLIER(Table1[Plant])&&Table1[Type]=EARLIER(Table1[Type])))
Hope this helps.
Hi,
This calculated column formula works
=CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[Plant]=EARLIER(Table1[Plant])&&Table1[Type]=EARLIER(Table1[Type])))
Hope this helps.
@MulberyPie -
You can do as a column:
Column =
VAR __pair = TableName[Plant] & TableName[Type]
VAR Result =
CALCULATE(
COUNTROWS(TableName),
TableName[Plant] & TableName[Type] = __pair
)
RETURN Result
or as a measure:
Measure =
VAR __pair = SELECTEDVALUE(TableName[Plant]) & SELECTEDVALUE(TableName[Type])
VAR Result =
CALCULATE(
COUNTROWS(TableName),
TableName[Plant] & TableName[Type] = __pair
)
RETURN Result
Proud to be a Super User!
I have a lot more columns than what is shown. When I use the column method it shows 1's next to every row, but when that column is put into a table with just the pair coulmns it shows a total, but that total has some wrong numbers. Some of the counts for the pairs are right, but some are too high. I think that having extra columns that can vary with the pair may mess up the new column method.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
121 | |
80 | |
47 | |
45 | |
35 |
User | Count |
---|---|
178 | |
89 | |
69 | |
47 | |
47 |