Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
munder
Frequent Visitor

contar datos en una columna a otra

buen dia

 

estimados necesito contar en una columana diferentes codigos, y en una columna nueva poner si el codigo esta repetido en la columna original o no.

 

muchas gracias por la ayuda.

1 ACCEPTED SOLUTION

hi  @munder 

For this logic, just use this formula to create a new column:

 CALCULATE(DISTINCTCOUNT('Table'[comment]),FILTER('Table','Table'[fecha]=EARLIER('Table'[fecha])&&'Table'[sala]=EARLIER('Table'[sala])))

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
amitchandak
Super User
Super User

@munder , Can you share sample data and sample output.

 

You can use distinctcount and count to check what is repeating

 

Measure = distinctcount (Table[A1]) -count (Table[A1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

fechacommentsalainformacion
03-03-20204561sala compartida
03-03-20204551sala compartida
03-03-20204572sala sola
03-03-20204583sala sola
04-03-20204561sala compartida
04-03-20204551sala compartida
04-03-20204572sala sola
04-03-20204583sala sola

 

Hi @amitchandak thank for the help, the idea is count if a comment is use in the same "sala" for a same "date", so if that is the case we call "sala Compartida" and if the comment is use in only one "sala" per "date" we call "sala sola"

hi  @munder 

You could use EARLIER to create a column as below:

Result = 
IF( CALCULATE(DISTINCTCOUNT('Table'[comment]),FILTER('Table','Table'[fecha]=EARLIER('Table'[fecha])&&'Table'[sala]=EARLIER('Table'[sala])))>1,
"sala Compartida",
"sala sola")

Result:

1.JPG

 

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

the problem with this is you only think in 2 or 1 counting and for the rest all is compartida,  but i have for example this 

 

fechacommentsalainformacion
03-03-20204561sala compartida
03-03-20204551sala compartida
03-03-20204571sala compartida
03-03-20204582sala compartida
03-03-20204562sala compartida
03-03-20204583sala sola
03-03-20204583sala sola
03-03-20204583sala sola

 

thanks and regards

hi @munder 

The logic for this for the same fecha and same sala, DISTINCTCOUNT comment, if the result is greater than 1, it returns sala compartida otherwise, returns sala sola.

 

What is your logic of your expected output? Could you please explain it more clearly?

Please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

the logic is if a "room" how many have the same comment and date.

im will change the query with this logic.

thanks and greetings

the logic is if a "sala" how many have the same comment and date.

 

im going to change the query with this logical.

 

thanks and regards 

hi  @munder 

For this logic, just use this formula to create a new column:

 CALCULATE(DISTINCTCOUNT('Table'[comment]),FILTER('Table','Table'[fecha]=EARLIER('Table'[fecha])&&'Table'[sala]=EARLIER('Table'[sala])))

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

thank for all @v-lili6-msft 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.