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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Subtraction for Group BY (Unique UID)

Hi Team,

 

I need your help for below calulation part,

Expected Result : a_Remaining Stock 
formula : (UID in Stock - a_Prod_Total ) 
note : UID in Stock and a_Prod_Total both are calculated in new Measure 

screen.PNG

 

Thanks,

KV's

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , The input table and ask is not matching.

 

But if you want an action on grouped data, these are the ways.

 

sumx(values(Table[UID]),[UID in Stock] -[a_Prod_Total])
sumx(summarize(Table,Table[UID],"_1",[UID in Stock] -[a_Prod_Total]),[_1])

 

If this does not help

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , The input table and ask is not matching.

 

But if you want an action on grouped data, these are the ways.

 

sumx(values(Table[UID]),[UID in Stock] -[a_Prod_Total])
sumx(summarize(Table,Table[UID],"_1",[UID in Stock] -[a_Prod_Total]),[_1])

 

If this does not help

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
AllisonKennedy
Community Champion
Community Champion

@Anonymous  Please can you provide more information on what you want to do and what currently doesn't work/where you're stuck? 

 

You should be able to do this using a table visual and simply using the measures you already have, just remove all the other columns from the table so only UID and the measures are in the table - this will automatically group by that column for you.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.