How do I count rows in one table based on values in another table using DAX?

0 votes

What I am trying to accomplish is to calculate the number of times that value appears in Table2 as a new column in Table1. How do I count rows in one table based on values in another table using DAX

Sep 24 in Power BI by anonymous
• 4,530 points
146 views

1 answer to this question.

0 votes

If the tables are related, this is very simple, you can see the below-given suggestion:

Number of Table2 rows = COUNTROWS(RELATEDTABLE(Table2))

Then you can add a Calculated Column to Table1 which counts the times each item appears in Table2:

Number of Table 2 rows: COUNTROWS(RELATEDTABALE(Table2))

If the tables are not related, you can use CALCULATE and FILTER:

Number of Table2 rows =
CALCULATE(
    COUNTROWS(Table2),
    FILTER(
        Table2,
        Table2[Column1] = Table1[Column1]
    )
)
answered Sep 24 by Gitika
• 41,080 points

Related Questions In Power BI

0 votes
1 answer

How do I label bar graph with different colors based on values from different slicers?

If the user selects only one value ...READ MORE

answered May 20, 2019 in Power BI by avantika
• 1,500 points
184 views
0 votes
1 answer

How to create final table based on Joins of two tables in power BI?

Hi Nithin, It is easy and simple. 1. Go ...READ MORE

answered Mar 1, 2019 in Power BI by Cherukuri
• 32,490 points
9,107 views
0 votes
1 answer

How do I show more than one data element in a 'card'?

Hi, In order to show more than one ...READ MORE

answered Jun 13, 2019 in Power BI by avantika
• 1,500 points
83 views
0 votes
3 answers

How do I get token using javascript API while trying to embed graphs using Power BI

Use ADAL.js that will give you an ...READ MORE

answered Jun 22, 2019 in Power BI by anonymous
1,979 views
0 votes
1 answer

How to get month name from month number in Power BI?

You can use: MonthName = FORMAT(DATE(1, [Num], 1), ...READ MORE

answered Sep 24 in Power BI by Alisha
25 views
0 votes
1 answer

How to ignore a slicer for one measure, but apply it on another?

In order to ignore Slicer you need ...READ MORE

answered Oct 1 in Power BI by Gitika
• 41,080 points
41 views
0 votes
1 answer

How do I use the DAX function ParallelPeriod?

The DAX expression you used in the ...READ MORE

answered Oct 5 in Power BI by Gitika
• 41,080 points
20 views
0 votes
1 answer
0 votes
1 answer

How do I get my DAX measure to calculate grouped values?

Try this: Total Usage:= SUMX( VALUES(MyTable[SensorID]), [Usage]) An alternative ...READ MORE

answered Oct 8 in Power BI by Gitika
• 41,080 points
20 views