Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ANTBressi
Regular Visitor

Return # of rows based on several criteria

Good Morning!

 

Looking for help in an issue with two tables I have. This is an example of what my data looks like in each table.

Table1

Truck#Reporting Party

1

A
1B
2A
2A
2A
3A
3A
3B
4B

Table2

Truck ## by reporting party "A"# by reporting party "B"
111
220
331
401

What i need is to be able to get the data of # by reporting party "A" and # by reporting party "B" from table 1 to exist in table 2 in order to be able to average later on in a bar chart. Any advice would be a huge help. Thank you!

1 ACCEPTED SOLUTION
AilleryO
Memorable Member
Memorable Member

Hi,

 

You can do it easily with power Query, just using the Group By button and then group by Truck# and Reporting Party :

GroupBy.png

The show the results in a matrix (not table), using Reporting party as column, truck as line and count as value.

And you'll get that :

Result.png

Hope it helps

View solution in original post

4 REPLIES 4
SpartaBI
Community Champion
Community Champion

@ANTBressi this is the DAX code for the new calculated table:

 

 

 

Table2 = 
ADDCOLUMNS(
    VALUES(Table1[Truck#]),
    "# by reporting party ""A""", CALCULATE(COUNTROWS(Table1), Table1[Reporting Party] = "A" ) + 0,
    "# by reporting party ""B""", CALCULATE(COUNTROWS(Table1), Table1[Reporting Party] = "B" ) + 0
)

SpartaBI_0-1652187123540.png

 

 

 

 


2022-05-09 22_36_04-Power BI Workspace Datasets License Permissions - Microsoft Power BI Community.png

Showcase Report – Contoso By SpartaBI


SpartaBI_3-1652115470761.png  SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Full-Logo11.png

Huge help! Worked like a charm!

AilleryO
Memorable Member
Memorable Member

Hi,

 

You can do it easily with power Query, just using the Group By button and then group by Truck# and Reporting Party :

GroupBy.png

The show the results in a matrix (not table), using Reporting party as column, truck as line and count as value.

And you'll get that :

Result.png

Hope it helps

Excellent, thank you!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.