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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
juancaoke
Frequent Visitor

COUNTIFS POWER BI

I have a table (Tabla_Radicados) I with the unique ID

 

ID_Radicado  

7122

7123

7124

7125

 

And I have another table (Tabla_Datos)  that among other columns has the following.

 

ID_Radicado   Activity           Result

 

7122                Attending       Continue

7122                Attending       Continue

7134                Attending       Continue

7124                Attending       Continue

7124                Attending       Continue

7124                Attending       Refuse

7124                No Attending Refuse

7125                Attending       Complement

7125                Attending       Continue

 

What I want to do is to créate, a column in Tabla_Radicados  that  Count  the number of times an ID is repeated, fulfilling the following filters Activity = Attending and Result = Continue.

 

If that condition is equal to 0 then in the column leave 0

If that condition is equal to 1 then in the column leave 1

If that condition is equal to 2 then in the column leave 2

In Excel, it would be an IF() and a COUNTIFS()

 

=IF(COUNTIFS (Histórico!G:G;A4;Histórico!M:M;"Atender Solicitud";Histórico!N:N;"Complementar Información")=0;0;

IF (COUNTIFS (Histórico!G:G;A4;Histórico!M:M;"Atender Solicitud";Histórico!N:N;"Complementar Información")=1;1;

IF(COUNTIFS (Histórico!G:G;A4;Histórico!M:M;"Atender Solicitud";Histórico!N:N;"Complementar Información")=2;2;

 

How can I achieve that?

 

3 REPLIES 3
Greg_Deckler
Super User
Super User

In DAX you use CALCULATE like this:

 

CALCULATE(COUNT([ID_Radicado],FILTER(Table_Datos,[Result]="Continue"))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks, but what I really need is a new Column. For each Row I need the result (Count Id where Activity = Attending and Result = CAONTINUE).

 

Meaning:

 

ID_Radicado    New Column

7122                      0 

7123                      2

7124                    1

 

Appreciate any help!

Thanx

OK, so that would be something like:

 

Column = COUNTX(FILTER(RELATEDTABLE(Tabla_Datos),[Activity]="Attending" && [Result]="Continue"),Tabla_Datos[ID_Radicado])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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