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, 2020 in Power BI by anonymous
• 10,520 points
21,642 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, 2020 by Gitika
• 65,910 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 21, 2019 in Power BI by Avantika
• 1,520 points
1,215 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 14, 2019 in Power BI by Avantika
• 1,520 points
492 views
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, 2020 in Power BI by Gitika
• 65,910 points
495 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
4,153 views
0 votes
1 answer
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, 2020 in Power BI by Alisha
5,532 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, 2020 in Power BI by Gitika
• 65,910 points
6,364 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, 2020 in Power BI by Gitika
• 65,910 points
654 views
0 votes
1 answer

In DAX, how do I RETURN the sum of a calculated column from a DAX Table Variable (created via ADDCOLUMN)?

You can access column variables of previously ...READ MORE

answered Oct 8, 2020 in Power BI by Gitika
• 65,910 points
4,084 views
0 votes
3 answers

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

To do so, follow these steps: From the ...READ MORE

answered Dec 16, 2020 in Power BI by Gitika
• 65,910 points
53,517 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP