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
petrutjim
Frequent Visitor

Result of a COUNT, used in another table

Hi guys,

 

I have 2 tables (table A and Table B) which are in a many to many realationship, trought another table (lets name it Table X).

 

petrutjim_2-1623928983618.png

 

If I join the tables, I would get the information in Table C.

 

Then in the dashboard, I can obtain the info from "PowerBI Table in Dashboard", by dragging column A from Table A and Column A from table B, and applying a COUNT on it. This is fine.

 

What I want to achieve and cannot is the last table, in which I want to keep the "Count TableC.ColumnB" and assign each fixed value to Column A.

 

I could use a merge, then create e new table with a group by and count, and then merge them toghether but for sure there is a solution using DAX.

 

Thank you in advance!

 

 

  

 

 

1 REPLY 1
PaulOlding
Solution Sage
Solution Sage

This measure will give you your expected output.  It has the IF function in the result to check if the combination of TableA.ColumnA and TableB.ColumnA exists in Column C.

 

Count TableC.ColumnB =
VAR _AllCount =
CALCULATE(
COUNTROWS('Table C'),
REMOVEFILTERS('Table B'[Column A])
)
VAR _RawCount = COUNTROWS('Table C')
VAR _Result = IF(ISBLANK(_RawCount), BLANK(), _AllCount)
RETURN
_Result

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.

Top Solution Authors