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
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
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.