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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.