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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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])

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.