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,480 points
22,637 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,770 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,480 views
0 votes
0 answers
0 votes
0 answers

How do I implement custom aggregations in Power BI using DAX?

How do I implement custom aggregations in ...READ MORE

Oct 14 in Power BI by anonymous
• 5,530 points
102 views
+2 votes
1 answer

How do I implement row-level security (RLS) in Power BI using DAX?

Suppose you are considering sharing your Power ...READ MORE

answered Oct 21 in Power BI by pooja
• 4,690 points
84 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
6,269 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,770 points
6,839 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,770 points
927 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,770 points
4,543 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,770 points
55,980 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