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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
xryu
Frequent Visitor

How to show all rows including the 0 value rows in the aggregated table.

Hello,

 

We have 4 companies, i.e. A, B, C, and D.

We have a table that records the item sales amount of each company, sample is shown below.

SalesTable

CompanyAmount
A10
B12
A15
D13
B25
B31
A21
D26
B32
A27

 

I need to calculate the total sales amount of each company and show in the result table.

Regardless the total sales amount is 0 or not, all companies are expected to show in the result table.

As shown in the below sample result table, total sales of Company C is 0, but it still shows up in the result.

Expected Result:

CompanyTotal Amount
A73
B100
C0
D39

 

I am implementing this aggregating calculation using the "Group By" in Power BI, however, Company C is NOT shown in the result table because the total sales amount is 0.

Result in Power BI:

CompanyTotal Amount
A73
B100
D39

 

Is there a way that we can get the full company list with the aggregate sales amount, even if it is 0 in Power BI?

Thank you for your kindly help!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@xryu , Create a company table with distinct companies and then join it back with company and use a measure with +0 

 

Company  = distinct(Table[Company]) // Make sure C is there , or bring from source

 

measure =  sum(Table[Sales]) +0

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@xryu , Create a company table with distinct companies and then join it back with company and use a measure with +0 

 

Company  = distinct(Table[Company]) // Make sure C is there , or bring from source

 

measure =  sum(Table[Sales]) +0

Hi amitchandak,

 

Thank you for the idea.

We were able to have Company C show up in the result table after left outer joined the company dictionary table to the aggregation result table, as you pointed out.

Somehow, the measure = sum(Table[Sales]) +0 did not work for us, but we were able to replace the null to 0

using the function in the Power Query Editor.

xryu_0-1680274548847.png

 

Thank you for your help, it really helped!

 

Bests.

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.