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
ferbyrez
Helper II
Helper II

Count (calculated table) from another table - No relationship!

Hi guys,

 

I´ve been trying to solve this but without sucess. basically I need a matrix ( or a table ) as described below:
I tryed the Calculate(count(filter))) but it shows me the same value per line.. 

i´m importing the columns to a table and want this calculation..

help!!.png

 

thanks !!

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

@ferbyrez Should be able to do this:

 

Count Column =
  COUNTROWS(FILTER('Table 2'),'Table 2'[ID] = [ID]))

@ 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...

View solution in original post

nandukrishnavs
Super User
Super User

@ferbyrez 

 

Try below the DAX measure.

Count from Table 2, Yes = 
VAR __selectedID =
    SELECTEDVALUE ( Table1[Id] )
VAR __count =
    COUNTX (
        FILTER ( Table2, Table2[Id] = __selectedID && Table2[Filter Table 2] = "Yes" ),
        Table2[Id]
    )
RETURN
    IF(ISBLANK(__count),0,__count)



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂 


Regards,
Nandu Krishna

View solution in original post

6 REPLIES 6
nandukrishnavs
Super User
Super User

@ferbyrez 

 

Try below the DAX measure.

Count from Table 2, Yes = 
VAR __selectedID =
    SELECTEDVALUE ( Table1[Id] )
VAR __count =
    COUNTX (
        FILTER ( Table2, Table2[Id] = __selectedID && Table2[Filter Table 2] = "Yes" ),
        Table2[Id]
    )
RETURN
    IF(ISBLANK(__count),0,__count)



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂 


Regards,
Nandu Krishna

It works bro! thanks all you guys.

Another solution : I created a colum based on the Filter2 Yes (if. .. filter = YES , "YES")

Created a new Table only with this columns.

Used the first formula @Greg_Deckler posted.

Thanks !

Greg_Deckler
Super User
Super User

@ferbyrez Should be able to do this:

 

Count Column =
  COUNTROWS(FILTER('Table 2'),'Table 2'[ID] = [ID]))

@ 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...

@Greg_Deckler , you should correct the parantheses in your DAX-formula.

@Greg_Deckler  it works perfectly to the purpose of "how many time appears in the other column" !

Now I need to "how many time appears in the other column with some specif filters in another column".

Thanks. bro

greg, thanks for helping.

 

but this cause will not bring me the filters I need in table 2 (YES), won´t it ?

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.