Calculate the number of occurance of a value in a column

Hi guys,

Hope you can help me out with this inquiry.

I´m trying to calculate the number of times a value is repeated in a column.

I´m currently working with Survey Data (A Huge Mess), I had to modify all the answer (Text Values) to numbers in Power Query before uploading them into the Data Model.

Any guidance on how to analyze only test data from a survey will be greatly appreciated.

Cheers,

Yeriel

@Yeriel,

Try this:

CALCULATE(
   COUNTROWS( Table ),
   Table[Column] = x
)

Where x is the value you want to count.

  • Brian
1 Like

Hi @BrianJ,

Thanks for the fast response.

Yes, the above formula it does count the number of times a Values is repeated.

On the other hand, is there another way of getting this exact result without using a table measure, let´s say at a column level?

The table that I´m filtering is Big and I don´t know if evaluating time is going to be long due to the table.

Thanks for the feedback!

Cheers.

Hi @Yeriel,

That’s kinda a trick question because all DAX measures work on tables… however you can replace the table reference with a virtual one look into SELECTCOLUMNS to extract the column you need. The pattern provided by @BrianJ remains the same although you can only use a naked column reference when using virtual tables for the filter condition.

I hope this is helpful.

2 Likes

Hi @Melissa!

Let me try out with this measure instead :wink:.

As always, an excellent Enterprise community!!

Thanks!

Hi @Yeriel, a response on this post has been tagged as “Solution”. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the check box. Also, we’ve recently launched the Enterprise DNA Forum User Experience Survey, please feel free to answer it and give your insights on how we can further improve the Support forum. Thanks!