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
Majidbhatti
Advocate IV
Advocate IV

Percentage for the Total is not correct

I have 2 tables and the output of which is not correct. 

Capture.PNG

 

Total of the "Sale Seat"col is adding correctly


Total of Inventory is not adding up because of which the OCCUPANCY is wrong.

 

 

Formula of OCCUPANCY is as below

OCCUPANCY = DIVIDE( Sum( 'Table1'[Sale seat] ), Sum('Table2'[Inventory]) , 0 )

 

1 ACCEPTED SOLUTION

hi @Majidbhatti 

If so, just adjust the formula as below:

New OCCUPANCY 3 = DIVIDE(SUM(Table1[Sales Seat]), SUMX(SUMMARIZE(Table1,Table1[Date],"_Inventory",SUMX(RELATEDTABLE(Table2),[Inventory])),[_Inventory]))
New OCCUPANCY 4 = DIVIDE(SUM(Table1[Sales Seat]), SUMX(SUMMARIZE(Table1,Table1[Date],Table1[Property Code],"_Inventory",SUMX(RELATEDTABLE(Table2),[Inventory])),[_Inventory]))

If not your case, just share a simple sample pbix file and your expected output.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-lili6-msft
Community Support
Community Support

hi @Majidbhatti 

This looks like a measure totals problem. Very common. See this post about it
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 

For your case, [Inventory] is in dim table(table2), so you could refer to these two simple way:

1. In the table1, use RELATED Function to create new Inventory column.

New Inventory = RELATED(Table2[Inventory])

Then adjust the formula as below:

New OCCUPANCY 1 = DIVIDE(SUM(Table1[Sales Seat]), SUM(Table1[New Inventory]))

 

2.
Just adjust the formula as below:

New OCCUPANCY 2 = DIVIDE(SUM(Table1[Sales Seat]), SUMX(Table1,RELATED(Table2[Inventory])))

 

Result:

4.JPG

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-lili6-msft ,

I guess you forgot to factor that the TABLE1 has repeated DATES.  I have tired both of your suggestion but it seem the Percentage is still not correct.

 

Any suggestion?

Capture.PNG

hi @Majidbhatti 

If so, just adjust the formula as below:

New OCCUPANCY 3 = DIVIDE(SUM(Table1[Sales Seat]), SUMX(SUMMARIZE(Table1,Table1[Date],"_Inventory",SUMX(RELATEDTABLE(Table2),[Inventory])),[_Inventory]))
New OCCUPANCY 4 = DIVIDE(SUM(Table1[Sales Seat]), SUMX(SUMMARIZE(Table1,Table1[Date],Table1[Property Code],"_Inventory",SUMX(RELATEDTABLE(Table2),[Inventory])),[_Inventory]))

If not your case, just share a simple sample pbix file and your expected output.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks a lot.. this did the magic.

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.